-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
'infer_freq' does not work with DST transition #8772
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
Comments
cc @rockg I am not sure this is a bug. The frequency inferer is looking for a constant difference between each of the times (essentially diffing them). So the freq by-definition is different around DST transitions. So |
I think this is a bug. In terms of hours, there is a constant difference. The code is converting the underlying UTC values to the local timezone so that week/month frequencies are calculated in local time (for example, 2010-12-25 00:00 is a Saturday in Paris but a Friday in UTC) but when that is done across timezones that shift becomes broken. The issue is in
Using the above example, we have:
Hopefully this is enough for somebody to go off on. It's not immediately obvious what the fix is (besides treating the sub-daily and daily+ offsets differently--not converting in the former and converting in the latter). |
I agree that |
I would also consider this a bug as the user is looking for the regular elapsed time between two timestamps. |
pls open a new issue with an example / this is 5 years old |
…and pandas-dev#8772) Fixes the issues pandas-dev#39556 and pandas-dev#8772 by ensuring that the check for delta being a multiple of a frequency also checks the delta is not 0 (which is a multiple of any number).
Consider the following index crossing a DST transition:
Pandas cannot infer the index frequency:
If we convert the index to UTC, the frequency can be inferred:
If the index does not cross a DST boundary, the frequency can be inferred as well:
The text was updated successfully, but these errors were encountered: