Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: DatetimeTZDtype support non-nano #47120

Merged
merged 6 commits into from
Jun 2, 2022

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@jreback jreback added Non-Nano datetime64/timedelta64 with non-nanosecond resolution Timezones Timezone data dtype labels May 27, 2022
with pytest.raises(ValueError, match=msg):
DatetimeTZDtype("ms", "US/Eastern")
def test_construction_non_nanosecond(self):
res = DatetimeTZDtype("ms", "US/Eastern")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the DatetimeTZDtype("D", "US/Eastern") raising case tested in this file as well?

Also would be good to have a full smoke test from one of the 1D constructors e.g. pd.array('2022-01-01', dtype='datetime64[us, US/Eastern]')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also would be good to have a full smoke test from one of the 1D constructors e.g. pd.array('2022-01-01', dtype='datetime64[us, US/Eastern]')

would prefer to hold off; there's a check in DTA._simple_new that i haven't yet updated to handle non-nano dt64tz, so that'll get a dedicated (small) PR that makes a good fit for what you're suggesting

num = 101
base = np.dtype("M8[ns]")
base = np.dtype("M8[ns]") # TODO: depend on reso?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If base is analogous to "default" I think M8[ns] is a reasonable default.

Copy link
Member Author

@jbrockmendel jbrockmendel Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed but not clear thats what 'base' means. would be good to have that documented somewhere.

The alternative (that ive put together for (Timestamp|Timedelta).(min|max|resolution)) is a property-like that assumes nanoseconds when accessed on the class and is instance-specific when accessed on an instance

@mroeschke mroeschke added this to the 1.5 milestone Jun 1, 2022
@mroeschke mroeschke merged commit 259a15c into pandas-dev:main Jun 2, 2022
@jbrockmendel jbrockmendel deleted the nano-dt64tz branch June 3, 2022 22:45
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
* ENH: DatetimeTZDtype support non-nano

* mypy fixup

* mypy fixup

* TST: Day not supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non-Nano datetime64/timedelta64 with non-nanosecond resolution Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants