-
-
Notifications
You must be signed in to change notification settings - Fork 395
Pandas compatibility of Timezone / Timezone Info #131
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
I investigated a bit and it seems that the segfault occurs when a call to Behind the scene, pandas will call: int(total_seconds(_get_utcoffset(tz, None))) in the _get_dst_info() function. However Here is what the offical Python documentation says (https://docs.python.org/3.6/library/datetime.html#datetime.tzinfo.utcoffset):
And in this case I am not sure how to approach this, but it seems to me that |
Agreed that It did find it surprising that |
Apparently this is a known issue at |
I think the main issue here is that For fixed zones like |
Hello !
and it crashes, whatever the timezone of pend is... EDIT |
Fixes pandas-dev/pandas#15986 Closes python-pendulum#131 As explained by @sdispater in the issues above, pandas tries to access the Timezone._utcoffset property: https://github.com/pandas-dev/pandas/blob/v1.0.5/pandas/_libs/tslibs/timezones.pyx#L153 This commit allows pandas to get _utcoffset from a Timezone object, taking the transision as seen from utcnow.
Hi I just came across this issue, and the related Pandas one: pandas-dev/pandas#15986 It seems that Pendulum is not 100% compatible with Pandas and some of the assumptions it makes about datetimes. I'm likely to now drop using it and revert to native datetime + pytz - which is a shame but I don't see a practical way round it given I use time indexed dataframes extensively. I appreciate it can argued that the fault lies with Pandas and assumptions made there, but given that Pandas DataFrame / DateTimeIndexes are one of the main uses of Python Datetimes, it seems a bit disingenuous to present Pendulum as a drop-in replacement when these issues still exist (regardless of 'blame'). At the very least this should be highlighted in the Limitations section of the documentation so people are aware of this before they make the investment. |
I think there is an incompatibility between
pandas
andpendulum.tz.timezone.Timezone
. I'm not sure who is to blame though, but as frompendulum.tz.timezone_info.TimezoneInfo
it seemed reasonable to check here first.Two examples of unexpected behaviour; the programs exit with a segmentation fault:
This program creates two date time ranges, but printing (creating a string representation) fails for the second:
In this example using UTCTimezone causes the segmentation fault:
I recon things go wrong when boxing in pandas. This is in C / Cython territory, so lot harder to debug for me.
Anyone ideas on the matter? I'd say
Timezone
probably behaves a bit different fromTimezoneInfo
but I really don't know where to start. I haven't even found their respective use cases yet.Versions used:
I'm running on Fedora Linux.
Thanks in advance!
The text was updated successfully, but these errors were encountered: