We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'd expect the [7] to produce the same result as [6], but instead it gives an error.
Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. IPython 2.1.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: from numpy import zeros In [2]: from pandas import Panel, MultiIndex In [3]: p1 = Panel(zeros((3,3,3)), items=['a','b','c'], major_axis=['x','y','z'], minor_axis=['u','v','w']) In [4]: mi = MultiIndex.from_tuples([(0,'x'), (1,'y'), (1,'z')]) In [5]: p2 = Panel(zeros((3,3,3)), items=['a','b','c'], major_axis=mi, minor_axis=['u','v','w']) In [6]: p1.iloc[:, 1, 0] Out[6]: a 0 b 0 c 0 Name: u, dtype: float64 In [7]: p2.iloc[:, 1, 0] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-7-f7c04712ad2b> in <module>() ----> 1 p2.iloc[:, 1, 0] C:\Python34\lib\site-packages\pandas\core\indexing.py in __getitem__(self, key) 1125 def __getitem__(self, key): 1126 if type(key) is tuple: -> 1127 return self._getitem_tuple(key) 1128 else: 1129 return self._getitem_axis(key, axis=0) C:\Python34\lib\site-packages\pandas\core\indexing.py in _getitem_tuple(self, tup) 1332 continue 1333 -> 1334 retval = getattr(retval, self.name)._getitem_axis(key, axis=axis) 1335 1336 # if the dim was reduced, then pass a lower-dim the next time C:\Python34\lib\site-packages\pandas\core\indexing.py in _getitem_axis(self, key, axis, validate_iterable) 1386 self._is_valid_integer(key, axis) 1387 -> 1388 return self._get_loc(key, axis=axis) 1389 1390 def _convert_to_indexer(self, obj, axis=0, is_setter=False): C:\Python34\lib\site-packages\pandas\core\indexing.py in _get_loc(self, key, axis) 87 88 def _get_loc(self, key, axis=0): ---> 89 return self.obj._ixs(key, axis=axis) 90 91 def _slice(self, obj, axis=0, typ=None): C:\Python34\lib\site-packages\pandas\core\panel.py in _ixs(self, i, axis) 803 if _is_list_like(key): 804 indexer = {self._get_axis_name(axis): key} --> 805 return self.reindex(**indexer) 806 807 # a reduction C:\Python34\lib\site-packages\pandas\core\panel.py in reindex(self, items, major_axis, minor_axis, **kwargs) 1109 else kwargs.pop('minor', None)) 1110 return super(Panel, self).reindex(items=items, major_axis=major_axis, -> 1111 minor_axis=minor_axis, **kwargs) 1112 1113 @Appender(_shared_docs['rename'] % _shared_doc_kwargs) C:\Python34\lib\site-packages\pandas\core\generic.py in reindex(self, *args, **kwargs) 1622 # perform the reindex on the axes 1623 return self._reindex_axes(axes, level, limit, -> 1624 method, fill_value, copy).__finalize__(self) 1625 1626 def _reindex_axes(self, axes, level, limit, method, fill_value, copy): C:\Python34\lib\site-packages\pandas\core\generic.py in _reindex_axes(self, axes, level, limit, method, fill_value, copy) 1639 ax = self._get_axis(a) 1640 new_index, indexer = ax.reindex( -> 1641 labels, level=level, limit=limit, method=method) 1642 1643 obj = obj._reindex_with_indexers( C:\Python34\lib\site-packages\pandas\core\index.py in reindex(self, target, method, level, limit, copy_if_needed) 3256 else: 3257 # hopefully? -> 3258 target = MultiIndex.from_tuples(target) 3259 3260 return target, indexer C:\Python34\lib\site-packages\pandas\core\index.py in from_tuples(cls, tuples, sortorder, names) 2809 tuples = tuples.values 2810 -> 2811 arrays = list(lib.tuples_to_object_array(tuples).T) 2812 elif isinstance(tuples, list): 2813 arrays = list(lib.to_object_array_tuples(tuples).T) C:\Python34\lib\site-packages\pandas\lib.pyd in pandas.lib.tuples_to_object_array (pandas\lib.c:52859)() TypeError: object of type 'numpy.int64' has no len()
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
I'd expect the [7] to produce the same result as [6], but instead it gives an error.
The text was updated successfully, but these errors were encountered: