Another somewhat degenerate case that works in 0.15.2, fails in 0.16.1
import pandas as pd pd.show_versions() ts = pd.TimeSeries() ts[pd.datetime(2012, 1, 1)] = 47 ts2 = pd.TimeSeries(0, pd.date_range('2011-01-01', '2011-01-01'))[:0] ts2[pd.datetime(2012, 1, 1)] = 47
0.15.2 output:
INSTALLED VERSIONS ------------------ commit: None python: 2.7.9.final.0 python-bits: 64 OS: Windows OS-release: 7 machine: AMD64 processor: Intel64 Family 6 Model 26 Stepping 5, GenuineIntel byteorder: little LC_ALL: None LANG: None pandas: 0.15.2 nose: 1.3.4 Cython: 0.21 numpy: 1.9.2 scipy: 0.14.0 statsmodels: 0.5.0 IPython: 3.0.0-dev sphinx: 1.2.3 patsy: 0.3.0 dateutil: 2.4.2 pytz: 2015.4 bottleneck: 0.8.0 tables: 3.1.1 numexpr: 2.3.1 matplotlib: 1.4.2 openpyxl: None xlrd: 0.9.3 xlwt: None xlsxwriter: 0.5.7 lxml: 3.4.0 bs4: 4.3.2 html5lib: 0.999 httplib2: None apiclient: None rpy2: None sqlalchemy: 0.9.7 pymysql: None psycopg2: None
0.16.1 output:
INSTALLED VERSIONS ------------------ commit: None python: 2.7.9.final.0 python-bits: 64 OS: Windows OS-release: 7 machine: AMD64 processor: Intel64 Family 6 Model 26 Stepping 5, GenuineIntel byteorder: little LC_ALL: None LANG: None pandas: 0.16.1-46-g0aceb38 nose: 1.3.6 Cython: 0.22 numpy: 1.9.2 scipy: 0.14.0 statsmodels: 0.6.1 IPython: 3.1.0 sphinx: 1.3.1 patsy: 0.3.0 dateutil: 2.4.2 pytz: 2015.4 bottleneck: 0.8.0 tables: 3.1.1 numexpr: 2.3.1 matplotlib: 1.4.3 openpyxl: None xlrd: 0.9.3 xlwt: None xlsxwriter: 0.7.2 lxml: None bs4: 4.3.2 html5lib: 0.999 httplib2: None apiclient: None sqlalchemy: 1.0.4 pymysql: None psycopg2: None --------------------------------------------------------------------------- IndexError Traceback (most recent call last) c:\test_set_empty_series_with_freq.py in <module>() 11 ts2 = pd.TimeSeries(0, pd.date_range('2011-01-01', '2011-01-01'))[:0] 12 ---> 13 ts2[pd.datetime(2012, 1, 1)] = 47 c:\python\envs\pandas-0.16.1\lib\site-packages\pandas\core\series.pyc in __setitem__(self, key, value) 687 # do the setitem 688 cacher_needs_updating = self._check_is_chained_assignment_possible() --> 689 setitem(key, value) 690 if cacher_needs_updating: 691 self._maybe_update_cacher() c:\python\envs\pandas-0.16.1\lib\site-packages\pandas\core\series.pyc in setitem(key, value) 660 pass 661 try: --> 662 self.loc[key] = value 663 except: 664 print "" c:\python\envs\pandas-0.16.1\lib\site-packages\pandas\core\indexing.pyc in __setitem__(self, key, value) 113 def __setitem__(self, key, value): 114 indexer = self._get_setitem_indexer(key) --> 115 self._setitem_with_indexer(indexer, value) 116 117 def _has_valid_type(self, k, axis): c:\python\envs\pandas-0.16.1\lib\site-packages\pandas\core\indexing.pyc in _setitem_with_indexer(self, indexer, value) 272 if self.ndim == 1: 273 index = self.obj.index --> 274 new_index = index.insert(len(index),indexer) 275 276 # this preserves dtype of the value c:\python\envs\pandas-0.16.1\lib\site-packages\pandas\tseries\index.pyc in insert(self, loc, item) 1523 # check freq can be preserved on edge cases 1524 if self.freq is not None: -> 1525 if (loc == 0 or loc == -len(self)) and item + self.freq == self[0]: 1526 freq = self.freq 1527 elif (loc == len(self)) and item - self.freq == self[-1]: c:\python\envs\pandas-0.16.1\lib\site-packages\pandas\tseries\index.pyc in __getitem__(self, key) 1351 getitem = self._data.__getitem__ 1352 if np.isscalar(key): -> 1353 val = getitem(key) 1354 return Timestamp(val, offset=self.offset, tz=self.tz) 1355 else: IndexError: index 0 is out of bounds for axis 0 with size 0
Proposed #10194
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4