-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DataFrame.reindex() with MultiIndex doesn't fill missing values #21147
New issue
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
Comments
Indeed, such a behavior would work just fine with a single |
idx, idxer = pd.Index(range(3)).reindex([0, 1, 4])
idx, idxer
# (Int64Index([0, 1, 4], dtype='int64'), array([ 0, 1, -1]))
idx.size
# 3
idx, idxer = pd.MultiIndex.from_arrays([['a']*3, range(3)]).reindex([0, 1, 4], level=1)
idx, idxer
# (MultiIndex(levels=[['a'], [0, 1, 4]],
# labels=[[0, 0], [0, 1]]), array([0, 1]))
idx.size
# 2 In reindexing, pandas/pandas/core/indexes/base.py Lines 4014 to 4019 in 172ab7a
|
@holymonson Thanks for the report. Going to close this in favor of:
But feel free to chime in on on those issues. |
Code Sample, a copy-pastable example if possible
Problem description
DataFrame.reindex()
withlevel
specified doesn't fill missing values.Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Darwin
OS-release: 17.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: zh_CN.UTF-8
LOCALE: zh_CN.UTF-8
pandas: 0.23.0
pytest: None
pip: 10.0.1
setuptools: 39.1.0
Cython: None
numpy: 1.14.3
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: None
sphinx: 1.6.2
patsy: None
dateutil: 2.7.2
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: 1.0.5
lxml: None
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: