-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
REGR: casting datetime strings with offzet to tz-naive datetime64 fails #50140
Comments
And to be clear, this is certainly a dubious case where it is not clear if we actually want this behaviour. I think it might make sense to raise for this in the future. But if we want to do that, it should still be a conscious decision (not accidental side effect of unrelated PR), and should probably first be deprecated. |
|
Yah that particular .astype is definitely wonky. We should add a whatnsew note announcing the new behavior as an API change in 2.0. |
It's something we can easily deprecate first, I think? |
@jbrockmendel do you have time to take a look at this? |
will take a look |
#51514 closes by documenting this as expected. |
To be explicit about the implications of doing this as a breaking change: this breaks pandas<->pyarrow roundtrips, and so eg also pandas<->parquet roundtripping (admittedly, in a somewhat corner case of using a DatetimeIndex for the column labels) So users doing pd.read_parquet(..) with a file they wrote earlier will now get an error (with released pyarrow) that they can't easily solve themselves. |
### What changes are included in this PR? - The issue with numpy 1.25 in the assert equal helper was fixed in pandas 1.5.3 -> removing the skip (in theory can still run into this error when using an older pandas version with the latest numpy, but that's not something you should do) - Casting tz-aware strings to datetime64[ns] was not fixed in pandas (pandas-dev/pandas#50140) -> updating our implementation to work around it - Casting to numpy string dtype (pandas-dev/pandas#50127) is not yet fixed -> updating the skip ### Are there any user-facing changes? No * Closes: #15070 Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
) ### What changes are included in this PR? - The issue with numpy 1.25 in the assert equal helper was fixed in pandas 1.5.3 -> removing the skip (in theory can still run into this error when using an older pandas version with the latest numpy, but that's not something you should do) - Casting tz-aware strings to datetime64[ns] was not fixed in pandas (pandas-dev/pandas#50140) -> updating our implementation to work around it - Casting to numpy string dtype (pandas-dev/pandas#50127) is not yet fixed -> updating the skip ### Are there any user-facing changes? No * Closes: apache#15070 Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
) ### What changes are included in this PR? - The issue with numpy 1.25 in the assert equal helper was fixed in pandas 1.5.3 -> removing the skip (in theory can still run into this error when using an older pandas version with the latest numpy, but that's not something you should do) - Casting tz-aware strings to datetime64[ns] was not fixed in pandas (pandas-dev/pandas#50140) -> updating our implementation to work around it - Casting to numpy string dtype (pandas-dev/pandas#50127) is not yet fixed -> updating the skip ### Are there any user-facing changes? No * Closes: apache#15070 Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
On pandas 1.5 (so no deprecation warning):
On the main branch:
This started to fail a few days ago on pyarrow's CI. This comes up if you roundtrip a pandas DataFrame where the columns are a tz-aware DatetimeIndex (in Arrow they will be string columns, and then in the arrow->pandas conversion we try to cast the string to datetime64 and then localize. We should probably directly cast to the tz-aware dtype).
From a quick look at the recent commits and the code path this takes, might be caused by #50015 (cc @jbrockmendel)
The text was updated successfully, but these errors were encountered: