You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importdatetimeimportpandasaspdseries=pd.Series(
list(range(8760)),
index=pd.date_range('2018/01/01', periods=8760, freq='H', tz='Europe/Berlin')
)
# trying to drop first dayseries=series.drop(
series.index[series.index<datetime.datetime(year=2018, month=1, day=2)]
)
# yields AmbiguousTimeError
File "pandas/_libs/tslib.pyx", line 3593, in pandas._libs.tslib.tz_localize_to_utc
pytz.exceptions.AmbiguousTimeError: Cannot infer dst time from Timestamp('2018-10-28 02:00:00'), try using the 'ambiguous' argument
Problem description
I can't use drop on series that have a timezone aware datetime index. For me, it is not understandable why the error displayed above is raised.
Code Sample, a copy-pastable example if possible
Problem description
I can't use
drop
on series that have a timezone aware datetime index. For me, it is not understandable why the error displayed above is raised.The workaround I found is:
Expected Output
No error. And the result the previous snippet yields.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Darwin
OS-release: 17.4.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
LOCALE: de_DE.UTF-8
pandas: 0.22.0
pytest: 3.4.2
pip: 9.0.1
setuptools: 38.5.2
Cython: None
numpy: 1.14.2
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: 1.7.1
patsy: None
dateutil: 2.6.1
pytz: 2018.3
blosc: None
bottleneck: None
tables: None
numexpr: 2.6.4
feather: None
matplotlib: None
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: 2.7.4 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: