-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
DatetimeDatetime data dtypeDatetime data dtypeTestingpandas testing functions or related to the test suitepandas testing functions or related to the test suiteTimezonesTimezone data dtypeTimezone data dtypegood first issue
Milestone
Description
Code Sample, a copy-pastable example if possible
import pandas as pd
start = pd.Timestamp('201710290100', tz='Europe/Brussels')
end = pd.Timestamp('201710290300', tz='Europe/Brussels')
index = pd.date_range(start=start, end=end, freq='15min')
index.drop(index[0])
AmbiguousTimeError: Cannot infer dst time from Timestamp('2017-10-29 02:00:00'), try using the 'ambiguous' argument
Problem description
When dropping from a localized DateTimeIndex, behind the scenes the index is converted to UTC, the drop is performed, and then it is converted back to the original timezone. (This is what I make of the traceback).
This second conversion is ambiguous because the original index contains a DST change.
Expected Output
Output of index.drop(index[0])
DatetimeIndex(['2017-10-29 01:15:00+02:00', '2017-10-29 01:30:00+02:00',
'2017-10-29 01:45:00+02:00', '2017-10-29 02:00:00+02:00',
'2017-10-29 02:15:00+02:00', '2017-10-29 02:30:00+02:00',
'2017-10-29 02:45:00+02:00', '2017-10-29 02:00:00+01:00',
'2017-10-29 02:15:00+01:00', '2017-10-29 02:30:00+01:00',
'2017-10-29 02:45:00+01:00', '2017-10-29 03:00:00+01:00'],
dtype='datetime64[ns, Europe/Brussels]', freq='15T')
antvig
Metadata
Metadata
Assignees
Labels
DatetimeDatetime data dtypeDatetime data dtypeTestingpandas testing functions or related to the test suitepandas testing functions or related to the test suiteTimezonesTimezone data dtypeTimezone data dtypegood first issue