-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: support pendulum objects #15986
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
this is a
we accept closing this as won't fix / out-of-scope. |
@jreback Author of >>> isinstance(pendulum.now().tzinfo, datetime.tzinfo)
True So, as you can see, The underlying problem comes from 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 So |
Thanks for the explanation @sdispater. |
I am not averse to changing this, but some concerns.
This is quite awkward in the context of having distinct notions of naive and tz-aware datetimes, which are both first class in pandas. So several paths exist:
2nd and 3rd would require fully passing the entire test suite with these objects fully tested. We test pytz and dateutil objects in many many ways. So if someone wants to do this go for it. Would take the first option (ban) immediately (pretty trivial), then others could be over time. |
I ran into this and was thoroughly confused. My jupyter notebook kernel kept dying with no indication of what the error was; it even took a good long time to discover that it was a segfault. Presumably many pandas users don't even know much about segfaults. Pandas doesn't have to accept pendulum objects, I think, but segfaulting really is not very polite. |
PR to for now at least raise an error instead of segfaulting is very welcome! (we can later still see whether to more fully support it or not) |
We'd also really appreciate an error being raised. Maybe another point here after talking to less experienced devs is that just segfaulting gives so little info on what even happened that it's hard to pinpoint that pendulum is even the problem, so there might be many users that aren't even aware that this is the issue they are looking for and just assume pandas is a buggy library. |
In 0.21.x this does not segfault, rather
jreback@97dddbc BUT
so if someone wants to take this and run with it would be great. |
closing as stale. would take a PR from the community though. |
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.
I see that the Pendulum issue has been closed without a fix, so if anyone wants a workaround to this: I did a roundtrip from Pendulum > ISO format > Pandas to avoid the internal lookup that causes the warning.
Not pretty but it will clean your error logs without hurting comprehension. |
Problem description
As
pendulum
claims to inherit fromdatetime.datetime
, I wouldn't expect a segfaut to happen, asdate_range
always worked find withdatetime
objectsFrom the documentation:
I could file an issue on the pendulum bug tracker as well, but that's pandas who's segfaulting, so I think you guys would have better tools to understand what's going on.
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Darwin
OS-release: 15.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: fr_BE.UTF-8
LOCALE: fr_BE.UTF-8
pandas: 0.19.2
nose: None
pip: 9.0.1
setuptools: 34.4.1
Cython: None
numpy: 1.12.1
scipy: None
statsmodels: None
xarray: None
IPython: 5.3.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.1.9
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.9.6
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: