Skip to content

BUG: .max() gives wrong answer for non-nanosecond datetimeindex #50719

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

Merged
merged 5 commits into from
Jan 13, 2023

Conversation

MarcoGorelli
Copy link
Member

Does this need a whatsnew? I wouldn't have thought so, as this wasn't available in 1.5.x

@MarcoGorelli MarcoGorelli added Bug Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Jan 12, 2023
@@ -372,7 +372,7 @@ def _wrap_results(result, dtype: np.dtype, fill_value=None):
if isna(result):
result = np.datetime64("NaT", "ns")
else:
result = np.int64(result).view("datetime64[ns]")
result = np.int64(result).view(dtype)
Copy link
Member

Choose a reason for hiding this comment

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

can you do the nat case a couple lines up too just to be on the safe side (like we do for td64 below)

@MarcoGorelli MarcoGorelli marked this pull request as draft January 12, 2023 21:45
@MarcoGorelli MarcoGorelli marked this pull request as ready for review January 13, 2023 09:03
@jorisvandenbossche jorisvandenbossche added this to the 2.0 milestone Jan 13, 2023
Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

LGTM

@MarcoGorelli
Copy link
Member Author

thanks - merging then as this is quite simple and unblocks rewriting tests for #50656

@MarcoGorelli MarcoGorelli merged commit 7afbdf1 into pandas-dev:main Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: .max() gives wrong answer for non-nanosecond datetimeindex
3 participants