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
[YES] I have checked that this issue has not already been reported.
[YES] I have confirmed this bug exists on the latest version of pandas.
[NO] (optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
idx1=pd.MultiIndex.from_tuples([(False, 1.0),
(False, 10.0),
(True, 1.0),
(True, 10.0)])
s1=pd.Series((0, 1, 2, 3), index=idx1)
s1.at[(False, 1.0)] # returns '0', expected outputidx2=pd.MultiIndex.from_tuples([(False,), (True,)])
s2=pd.Series((0, 1), index=idx2)
s2.at[False] # returns a pandas.Series with one element
Problem description
As per the user guide, I expect at[] to return a scalar. However, when I index a Series with a MultiIndex with only one level, at[] returns a Series with a single element. A Series with a multi-level MultiIndex works as expected.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : db08276
python : 3.6.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-54-generic
Version : #60-Ubuntu SMP Fri Nov 6 10:37:59 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
[YES] I have checked that this issue has not already been reported.
[YES] I have confirmed this bug exists on the latest version of pandas.
[NO] (optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
As per the user guide, I expect
at[]
to return a scalar. However, when I index aSeries
with aMultiIndex
with only one level,at[]
returns aSeries
with a single element. ASeries
with a multi-levelMultiIndex
works as expected.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : db08276
python : 3.6.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-54-generic
Version : #60-Ubuntu SMP Fri Nov 6 10:37:59 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.3
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.4
setuptools : 50.3.1.post20201107
Cython : None
pytest : None
hypothesis : None
sphinx : 3.2.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.16.1
pandas_datareader: None
bs4 : None
bottleneck : 1.3.2
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : 2.7.1
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: