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
seems p.ix[:,[-1],:] throws an exception (from take)
p.ix[:,-1:,:] is the workaround
maybe add to the docs?
ipython session follows:
9/10/12 panel test ix change
1/2
In [7]:
In [2]:
Out[2]: <class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 8 (major) x 4 (minor)
Items: Item1 to Item2
Major axis: 2000-01-01 00:00:00 to 2000-01-08 00:00:00
Minor axis: A to D
In [6]:
\---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/mnt/home/jreback/<ipython-input-6-1531bef93beb> in <module>()
1 # this worked prior to 0.8
----> 2 p.ix[:,[-1],:]
/usr/local/lib/python2.7/site-packages/pandas-0.8.1-py2.7-linuxx86_
64.egg/pandas/core/indexing.pyc in __getitem__(self, key)
31 pass
32
---> 33 return self._getitem_tuple(key)
34 else:
35 return self._getitem_axis(key, axis=0)
/usr/local/lib/python2.7/site-packages/pandas-0.8.1-py2.7-linuxx86_
64.egg/pandas/core/indexing.pyc in _getitem_tuple(self, tup)
137 continue
138
--> 139 retval = retval.ix._getitem_axis(key, axis=i)
140
141 return retval
/usr/local/lib/python2.7/site-packages/pandas-0.8.1-py2.7-linuxx86_
64.egg/pandas/core/indexing.pyc in _getitem_axis(self, key, axis)
247 raise ValueError('Cannot index with multidimensional key')
248
--> 249 return self._getitem_iterable(key, axis=axis)
250 elif axis == 0:
251 is_int_index = _is_integer_index(labels)
/usr/local/lib/python2.7/site-packages/pandas-0.8.1-py2.7-linuxx86_
64.egg/pandas/core/indexing.pyc in _getitem_iterable(self, key, axis)
295
296 if _is_integer_dtype(keyarr) and not _is_integer_index(labels):
--> 297 return self.obj.take(keyarr, axis=axis)
298
299 # this is not the most robust, but...
/usr/local/lib/python2.7/site-packages/pandas-0.8.1-py2.7-linuxx86_
64.egg/pandas/core/generic.pyc in take(self, indices, axis)
857 new_data = self._data.reindex_axis(new_items, axis=0)
858 else:
import pandas
index = pandas.date_range('1/1/2000', periods=8,)
p = pandas.Panel(np.random.randn(2, len(index), 4), items=['Item1', 'Item2'], major_axis
p
\# this worked prior to 0.8
p.ix[:,[-1],:]
9/10/12 panel test ix change
2/2
--> 859 new_data = self._data.take(indices, axis=axis)
860 return self._constructor(new_data)
861
/usr/local/lib/python2.7/site-packages/pandas-0.8.1-py2.7-linuxx86_
64.egg/pandas/core/internals.pyc in take(self, indexer, axis)
1075 n = len(self.axes[axis])
1076 if ((indexer == -1) | (indexer >= n)).any():
-> 1077 raise Exception('Indices must be nonzero and less than '
1078 'the axis length')
1079
Exception: Indices must be nonzero and less than the axis length
In [5]:
Out[5]: <class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 1 (major) x 4 (minor)
Items: Item1 to Item2
Major axis: 2000-01-08 00:00:00 to 2000-01-08 00:00:00
Minor axis: A to D
In [ ]:
\# this works ok
p.ix[:,-1:,:]
The text was updated successfully, but these errors were encountered:
seems p.ix[:,[-1],:] throws an exception (from take)
p.ix[:,-1:,:] is the workaround
maybe add to the docs?
ipython session follows:
9/10/12 panel test ix change
The text was updated successfully, but these errors were encountered: