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
I just upgraded to pandas 0.15.2 and now hit this when I do resample. It worked fine in 0.15.1 (I rolled back to 0.15.1 to confirm). As far as I can tell it occurs when the first date in the index is during daylight savings and the last is not, or vice versa.
For example, with a date just before and another just after the DST change date of April 6:
Traceback (most recent call last):
File "D:/Documents/Programming/Projects/IB/play.py", line 1332, in
main()
File "D:/Documents/Programming/Projects/IB/play.py", line 48, in main
print(df.resample('1D', how={'open':'first'}))
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\core\generic.py", line 3005, in resample
return sampler.resample(self).finalize(self)
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 85, in resample
rs = self._resample_timestamps()
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 275, in _resample_timestamps
self._get_binner_for_resample(kind=kind)
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 123, in _get_binner_for_resample
self.binner, bins, binlabels = self._get_time_bins(ax)
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 184, in _get_time_bins
bins = lib.generate_bins_dt64(ax_values, bin_edges, self.closed, hasnans=ax.hasnans)
File "pandas\lib.pyx", line 1064, in pandas.lib.generate_bins_dt64 (pandas\lib.c:17790)
ValueError: Values falls after last bin
On the other hand if I roll back to 0.15.1 I get what I expect:
open
2014-04-04 00:00:00+11:00 0.5
2014-04-05 00:00:00+11:00 NaN
2014-04-06 00:00:00+11:00 NaN
2014-04-07 00:00:00+10:00 0.5
Alternatively in 0.15.2 if I add another date in the previous year, such that the first and last dates are either both in daylight savings (even in a different year) or both not in daylight savings, it also seems to work fine.
The text was updated successfully, but these errors were encountered:
fantabolous
changed the title
BUG: "ValueError: Values falls after last bin" on resample('1D') of df with DST index
BUG: "ValueError: Values falls after last bin" on resample('1D') of df with DST index, new in 0.15.2
Dec 30, 2014
I just upgraded to pandas 0.15.2 and now hit this when I do resample. It worked fine in 0.15.1 (I rolled back to 0.15.1 to confirm). As far as I can tell it occurs when the first date in the index is during daylight savings and the last is not, or vice versa.
For example, with a date just before and another just after the DST change date of April 6:
Traceback (most recent call last):
File "D:/Documents/Programming/Projects/IB/play.py", line 1332, in
main()
File "D:/Documents/Programming/Projects/IB/play.py", line 48, in main
print(df.resample('1D', how={'open':'first'}))
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\core\generic.py", line 3005, in resample
return sampler.resample(self).finalize(self)
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 85, in resample
rs = self._resample_timestamps()
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 275, in _resample_timestamps
self._get_binner_for_resample(kind=kind)
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 123, in _get_binner_for_resample
self.binner, bins, binlabels = self._get_time_bins(ax)
File "C:\Users\Tom\Anaconda\envs\py2test\lib\site-packages\pandas\tseries\resample.py", line 184, in _get_time_bins
bins = lib.generate_bins_dt64(ax_values, bin_edges, self.closed, hasnans=ax.hasnans)
File "pandas\lib.pyx", line 1064, in pandas.lib.generate_bins_dt64 (pandas\lib.c:17790)
ValueError: Values falls after last bin
On the other hand if I roll back to 0.15.1 I get what I expect:
open
2014-04-04 00:00:00+11:00 0.5
2014-04-05 00:00:00+11:00 NaN
2014-04-06 00:00:00+11:00 NaN
2014-04-07 00:00:00+10:00 0.5
Alternatively in 0.15.2 if I add another date in the previous year, such that the first and last dates are either both in daylight savings (even in a different year) or both not in daylight savings, it also seems to work fine.
The text was updated successfully, but these errors were encountered: