-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
BUG: fix AttributeError raised with pd.concat between a None and timezone-aware Timestamp #54428
Conversation
…ne_with_timestamp_raisis_error
…ne_with_timestamp_raisis_error
…ne_with_timestamp_raisis_error
pandas/core/internals/managers.py
Outdated
@@ -2274,7 +2275,7 @@ def _preprocess_slice_or_indexer( | |||
def make_na_array(dtype: DtypeObj, shape: Shape, fill_value) -> ArrayLike: | |||
if isinstance(dtype, DatetimeTZDtype): | |||
# NB: exclude e.g. pyarrow[dt64tz] dtypes | |||
i8values = np.full(shape, fill_value._value) | |||
i8values = np.full(shape, Timestamp(fill_value)._value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to be sure that the Timestamp here has the same unit as the dtype
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the unit.
Is this function only for NA fill_value? Then it seems unit has no effect since NaT does not have unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its always NA for concat, but we can get here with non-NA via reindex with fill_vlaue
I notice something weird in the test for reindex with fill_value below. pandas/pandas/tests/frame/methods/test_reindex.py Lines 139 to 148 in 14a6c9a
Though the test passes, the representation seems weird. print(res) shows,
0 1
0 1 1969-12-31 16:00:01.681173120-08:00 while it should be as 0 1
0 1 2023-04-10 17:32:00-07:00 It seems pandas/pandas/core/internals/managers.py Lines 2298 to 2302 in 14a6c9a
|
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
Still waiting for requested review, any update needed from my side? |
This looks good to me. can you move the whatsnew note to 2.2 |
Thanks. I've moved the note. |
Thanks @yuanx749 |
Take over #53042. I updated the test. It should produce a FutureWarning.
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.