NonExistentTimeError after Resample #19375
import pandas as pd import numpy as np import pytz index=pd.date_range('2017-03-12', '2017-03-12 1:45:00', freq='15T') my_series = pd.Series(np.zeros(len(index)), index=index) my_series = my_series.tz_localize('US/Pacific') my_series.resample('900S').mean()
Some Version Information:
The above code returns the error message NonExistentTimeError: 2017-03-12 02:00:00; however, the input series only contains timestamps up to 2017-03-12 01:45:00. Does anyone understand why this error is occurring? If so, how can I address the problem?
Had a quick look into this and can reproduce consistently. Exception is thrown by
I isolated the values from the example above, and found some others that also result in an exception like this. Time zone and last_dst values don't seem to make a difference.
from pandas._libs.lib import Timestamp fresult = 1489276800000000000 lresult = 1489284000000000000 last_tzinfo = 'US/Pacific' last_dst = False # this is fine Timestamp(fresult).tz_localize(last_tzinfo, ambiguous=last_dst) # this is not Timestamp(lresult).tz_localize(last_tzinfo, ambiguous=last_dst) # other problematic examples Timestamp(1489285000000000000).tz_localize(last_tzinfo, ambiguous=last_dst) Timestamp(1489286000000000000).tz_localize(last_tzinfo, ambiguous=last_dst)