Skip to content
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

Hitting AmbiguousTimeError when exiting DST using .loc #20724

jackalack opened this issue Apr 17, 2018 · 2 comments


None yet
5 participants
Copy link

commented Apr 17, 2018

Code Sample, a copy-pastable example if possible

import pandas as pd
import arrow
import datetime
from dateutil import tz

test_time = arrow.get(datetime.datetime(2015,11,1), "US/Pacific").datetime
timestamps = [test_time + datetime.timedelta(seconds=i * 900) for i in range(16)]
my_series = pd.Series([0], index=[timestamps[0].replace(tzinfo=None)])
my_series = my_series.tz_localize(tz.gettz("US/Pacific"), ambiguous='infer')

for ts in timestamps:
    my_series.loc[ts] = 1

Problem description

I have a program that is running as a service and slowly adds timestamps to a pandas series. When running simulations, it always breaks when exiting DST.


commit: None
python-bits: 64
OS: Darwin
OS-release: 17.4.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LOCALE: None.None

pandas: 0.22.0
pytest: None
pip: 9.0.1
setuptools: 38.2.3
Cython: 0.24
numpy: 1.13.3
scipy: 0.18.1
pyarrow: None
xarray: None
IPython: 5.5.0
sphinx: None
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.1.0
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.5.1
html5lib: 1.0b10
sqlalchemy: 1.2.4
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None


This comment has been minimized.

Copy link

commented Apr 18, 2018

I could not run the example provided, as name 'tz' is not defined - can you post a minimally reproducible example to describe the issue and expected behavior?


This comment has been minimized.

Copy link

commented Apr 18, 2018

@WillAyd apologies, I missed that import. Just updated it above

@jackalack jackalack closed this Apr 18, 2018

@jackalack jackalack reopened this Apr 18, 2018

@mroeschke mroeschke referenced this issue Aug 5, 2018


CLN: Old timezone issues #22201

8 of 8 tasks complete

@jreback jreback added this to the 0.24.0 milestone Aug 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.