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
If I create a view on a subset of a dataframe with a Multiindex using .loc, if I print the index of the subset, it get the expected subset of the Multiindex. However index.levels and index.levshape return the values for the original dataframe, not the subset.
If the index of the created view is only the subset of values which appear in the view, the index methods levels and levshape should reflect this subset of values, not the whole index of the original dataframe
If I create a view on a subset of a dataframe with a Multiindex using
.loc
, if I print the index of the subset, it get the expected subset of the Multiindex. Howeverindex.levels
andindex.levshape
return the values for the original dataframe, not the subset.Problem description
If the index of the created view is only the subset of values which appear in the view, the index methods
levels
andlevshape
should reflect this subset of values, not the whole index of the original dataframeExpected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : d9fff27
python : 3.8.5.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-957.1.3.el7.x86_64
Version : #1 SMP Thu Nov 29 14:49:43 UTC 2018
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : None.None
pandas : 1.1.0
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2
setuptools : 49.2.0.post20200712
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.17.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.0
numexpr : None
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: