Series with MultiIndex "at" function raises "TypeError" · Issue #26989 · pandas-dev/pandas (original) (raw)
Code Sample
Your code here
import pandas as pd s = pd.Series(index=pd.MultiIndex.from_tuples([('a', 0)])) s.loc['a', 0] # loc function works fine, no complaints here s.at['a', 0] # raises TypeError
Stack Trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 2270, in __getitem__
return self.obj._get_value(*key, takeable=self._takeable)
TypeError: _get_value() got multiple values for argument 'takeable'
Problem description
I would expect the at
function to either return the values given by the indexers or raise a KeyError
. In the above example, the index value exists, so at
should return the value from the series at that index (nan
).
The at
function works fine for series with normal indexes. There is nothing in the documentation indicating it should not work for multi-indexes.
Expected Output
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.0-50-generic
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.2
pytest: 3.4.2
pip: 19.1.1
setuptools: 41.0.1
Cython: 0.29.10
numpy: 1.16.4
scipy: 1.3.0
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2019.1
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10.1
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None