pydata/pandas — Issue #878: Subsetting with lists fails with TypeError
Author: jhaynes
Created: 2012-03-08 01:11:14+00:00
State: open

``` python

from pandas import *
import pandas
import numpy as np

df = DataFrame({'a': np.random.randn(6),
'b': ['foo', 'bar'] * 3,
'c': np.random.randn(6)})

df.ix[2:4, ['b','c']]

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/sandbox/PandasTutorial/ in ()
----> 1 df.ix[2:4, ['b','c']]

/software/pandas/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)

/software/pandas/pandas/core/indexing.pyc in _getitem_tuple(self, tup)
113 continue
114
--> 115 retval = retval.ix._getitem_axis(key, axis=i)
116
117 return retval

/software/pandas/pandas/core/indexing.pyc in _getitem_axis(self, key, axis)
172 raise ValueError('Cannot index with multidimensional key')
173
--> 174 return self._getitem_iterable(key, axis=axis)
175 elif axis == 0:
176 is_int_index = _is_integer_index(labels)

/software/pandas/pandas/core/indexing.pyc in _getitem_iterable(self, key, axis)
213 keyarr = labels.take(keyarr)
214
--> 215 return self.obj.reindex(**{axis_name: keyarr})
216
217 def _convert_to_indexer(self, obj, axis=0):

/software/pandas/pandas/core/frame.pyc in reindex(self, index, columns, method, level, fill_value, copy)
1844
1845 if columns is not None:
-> 1846 frame = frame._reindex_columns(columns, copy, level, fill_value)
1847
1848 return frame

/software/pandas/pandas/core/frame.pyc in _reindex_columns(self, new_columns, copy, level, fill_value)
1907 new_columns, indexer = self.columns.reindex(new_columns, level=level)
1908 return self._reindex_with_indexers(None, None, new_columns, indexer,
-> 1909 copy, fill_value)
1910
1911 def _reindex_with_indexers(self, index, row_indexer, columns, col_indexer,

/software/pandas/pandas/core/frame.pyc in _reindex_with_indexers(self, index, row_indexer, columns, col_indexer, copy, fill_value)
1922 # TODO: speed up on homogeneous DataFrame objects
1923 new_data = new_data.reindex_indexer(columns, col_indexer, axis=0,
-> 1924 fill_value=fill_value)
1925 elif columns is not None and columns is not new_data.axes[0]:
1926 new_data = new_data.reindex_items(columns, copy=copy,

/software/pandas/pandas/core/internals.pyc in reindex_indexer(self, new_axis, indexer, axis, fill_value)
735 """
736 if axis == 0:
--> 737 return self._reindex_indexer_items(new_axis, indexer, fill_value)
738
739 mask = indexer == -1

/software/pandas/pandas/core/internals.pyc in _reindex_indexer_items(self, new_items, indexer, fill_value)
755 # TODO: less efficient than I'd like
756
--> 757 item_order = com.take_1d(self.items.values, indexer)
758
759 # keep track of what items aren't found anywhere

/software/pandas/pandas/core/common.pyc in take_1d(arr, indexer, out, fill_value)
186 out = np.empty(n, dtype=arr.dtype)
187 take_f = _take1d_dict[dtype_str]
--> 188 take_f(arr, indexer, out=out, fill_value=fill_value)
189 else:
190 out = arr.take(indexer, out=out)

/software/pandas/pandas/_tseries.so in pandas._tseries.take_1d_object (pandas/src/tseries.c:43051)()

TypeError: take_1d_object() got an unexpected keyword argument 'fill_value'
```