-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: Reindexing a DatetimeIndex during Daylight Saving Transition Causes Segmentation Fault with dateutil tz #40817
Comments
This looks specific to dateutil timezones
which #33931 might be the root cause. Would be good to keep this issue open as a test case once the issue above is fixed |
Could this be a related problem?
|
Just going to update to say that I saw this issue again this weekend when the To anyone also having this problem, I believe it can be fixed by using a fill method and then overriding the fill like:
|
On both main and 1.4.x, with the example in the OP I'm seeing the result
which is correct. The linked PR reported to close this issue, but it did not get automatically closed because it had two issues mentioned on a single line. |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
While the above code should replace the DatetimeIndex of the DataFrame with
["1", "2"]
, it instead causes a segmentation fault.This seems to only happen during the Daylight Savings transition during this Chilean timezone, and it seems to only happen if the two values are before and after the timezone switch.
While debugging, it seems that sometime between when
self._engine.get_indexer
is called inpandas/core/indexes/base.py:get_indexer
and whenutcoffset
is called indateutil/tz/tz.py
(the most granular I get get via stepping in pdb) - the value of the second index enters a broken state. Some values from withinutcoffset
are shown below.In pandas version
1.1.4
I was able to solve this problem by settingmethod="pad"
so that a different indexer would be used. However, in pandas1.2.3
I get segmentation faults for all 3 values (bfill
,ffill
, None).Expected Output
I would expect this to run normally - resetting the index of the DataFrame with the index given
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : f2c8480
python : 3.7.10.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.128-microsoft-standard
Version : #1 SMP Tue Jun 23 12:58:10 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.3
numpy : 1.20.2
pytz : 2021.1
dateutil : 2.8.1
pip : 9.0.1
setuptools : 39.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 0.999999999
pymysql : None
psycopg2 : None
jinja2 : 2.10
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: