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

REF: delta_to_nanoseconds handle non-nano #47191

Merged
merged 1 commit into from
Jun 1, 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.

except NotImplementedError:
if allow_year_month:
td64 = ensure_td64ns(delta)
return delta_to_nanoseconds(td64, reso=reso)
Copy link
Member

Choose a reason for hiding this comment

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

Should reso always be NPY_FR_ns here? If so, should be safer to just hardcode reso=NPY_FR_ns?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, will update

Copy link
Member Author

Choose a reason for hiding this comment

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

wait, no. this is correct as-is

Copy link
Member

Choose a reason for hiding this comment

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

Ah so this branch converts delta to ns no matter what to ensure the recursive call will exit appropriately the next time. Got it

is_timedelta64_object(other)
and get_datetime64_unit(other) == NPY_DATETIMEUNIT.NPY_FR_GENERIC
):
# TODO: deprecate allowing this? We only get here
Copy link
Member

Choose a reason for hiding this comment

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

Deprecate specifically adding a np.timedelta64 object without a unit (and not the interval adding behavior)?

If so, +1.

Copy link
Member Author

Choose a reason for hiding this comment

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

correct

@mroeschke mroeschke added this to the 1.5 milestone Jun 1, 2022
@mroeschke mroeschke added Timedelta Timedelta data type Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Jun 1, 2022
@mroeschke mroeschke merged commit 7c5c81e into pandas-dev:main Jun 1, 2022
@jbrockmendel jbrockmendel deleted the ref-delta_to_nanoseconds branch June 1, 2022 22:07
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
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 Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants