BUG: read parquet files with older pytz (DEP: keep lower pytz minimum version)#65133
BUG: read parquet files with older pytz (DEP: keep lower pytz minimum version)#65133mroeschke merged 5 commits intopandas-dev:mainfrom
Conversation
|
For the case you would still have an older pytz than >>> import pytz
>>> pd.Timestamp(2012, 1, 1).tz_localize("UTC").tz_convert(pytz.timezone("Europe/Brussels"))
Timestamp('2012-01-01 00:18:00+0018', tz='Europe/Brussels')
# should be Timestamp('2012-01-01 01:00:00+0100', tz='Europe/Brussels')Although then some other parts raise a error (like what read_parquet ran into). I could easily make That is what I added in the last commit (but since this is somewhat of a breaking change, I could also keep that for a separate PR for 3.1) |
|
Is it viable to write a test for this? |
|
Not directly, since it is for the case where pytz is too old, and we don't have a CI build for that. I don't know if it would be possible to mock the pytz version in a test? |
I don't think so, especially if pyarrow is going to move to zoneinfo in the foreseeable future. Thanks for taking a look |
|
Thanks @jorisvandenbossche |
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
When we made
pytzan optional dependency (#59089), we also bumped the minimum version (and later bumped it once more #62241). This causes issues with reading parquet files when someone does not have this required minimum version (the reported bug in #64978).While we could solve this by improving the error message you get (so it is clear you have to update pytz), I also think there is not really a need to bump the minimum version here (pytz is mostly in maintenance mode AFAIK, and so the newer versions I assume are mostly updating the tz data)
For
tzdatawe actually decided to remove the minimum version altogether (#63335), but since pytz is still an API in addition to the tz data, I just kept the minimum version we had before in pandas 2.x (that should then at least not give problems for people upgrading from pandas 2 to 3 without upgrading pytz).doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.