Skip to content

Hierarchical reindexing with NaN in index #7052

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

Closed
Marigold opened this issue May 6, 2014 · 1 comment
Closed

Hierarchical reindexing with NaN in index #7052

Marigold opened this issue May 6, 2014 · 1 comment
Labels
Bug Duplicate Report Duplicate issue or pull request Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate MultiIndex
Milestone

Comments

@Marigold
Copy link

Marigold commented May 6, 2014

related #6322
dupe of #7031

I'm on 0.13.1, don't know if this is already fixed on master, but haven't found any issues about this. If I you have NaN value in MultiIndex, reindexing will fill the first value from reindexed series to all NaN indices. Perhaps an example will clarify it

Code:

import pandas as pd
import numpy as np

ix = pd.MultiIndex.from_tuples([('a',np.nan)], names=['col1', 'col2'])
pd.Series([1], index=[1]).reindex(ix, level=1)

Output:

col1  col2
a     NaN     1

Desired output:

col1  col2
a     NaN     NaN
@jreback jreback modified the milestone: 0.15.0 May 6, 2014
@jreback
Copy link
Contributor

jreback commented May 6, 2014

dupe of #7031
in general this is an ambiguous operation and should be avoided (nan's in the multiindex)

@jreback jreback closed this as completed May 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate MultiIndex
Projects
None yet
Development

No branches or pull requests

2 participants