Skip to content

Conversation

lukemanley
Copy link
Member

fixes the following inconsistency:

from pandas.core.arrays.datetimes import DatetimeArray
import numpy as np

data = np.array([1], dtype="datetime64[s]")
dta = DatetimeArray(data)

print(dta.unit)     # ns
print(dta[0].unit)  # s

@lukemanley lukemanley added Bug Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Apr 9, 2023
- Bug in :meth:`Timestamp.round` with values close to the implementation bounds returning incorrect results instead of raising ``OutOfBoundsDatetime`` (:issue:`51494`)
- :meth:`DatetimeIndex.map` with ``na_action="ignore"`` now works as expected. (:issue:`51644`)
- Bug in :meth:`arrays.DatetimeArray.map` and :meth:`DatetimeIndex.map`, where the supplied callable operated array-wise instead of element-wise (:issue:`51977`)
- Bug in :class:`arrays.DatetimeArray` constructor returning an incorrect unit when passed a non-nanosecond numpy datetime array (:issue:`52555`)
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be okay to backport this to 2.0.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.

moved to 2.0.1 - thanks

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

Merge conflict otherwise LGTM

@mroeschke mroeschke added this to the 2.0.1 milestone Apr 11, 2023
@mroeschke mroeschke merged commit 7c55534 into pandas-dev:main Apr 11, 2023
@mroeschke
Copy link
Member

Thanks @lukemanley

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Apr 11, 2023
mroeschke pushed a commit that referenced this pull request Apr 11, 2023
…tructed from a non-nano ndarray) (#52608)

Backport PR #52555: BUG: DatetimeArray.unit when constructed from a non-nano ndarray

Co-authored-by: Luke Manley <lukemanley@gmail.com>
@lukemanley lukemanley deleted the dta-non-nano-numpy branch April 18, 2023 11:03
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.

2 participants