Skip to content

DataFrame.fillna corrupts columns with duplicated names #12344

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
hantusk opened this issue Feb 16, 2016 · 3 comments
Closed

DataFrame.fillna corrupts columns with duplicated names #12344

hantusk opened this issue Feb 16, 2016 · 3 comments
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone

Comments

@hantusk
Copy link

hantusk commented Feb 16, 2016

# Pandas version 0.17.1
import pandas as pd
df = pd.DataFrame({'Same': 1.0, ' Same': pd.np.nan, '  Same': pd.np.nan}, index=[0,1,2])
df.columns = [c.strip() for c in df.columns]
df.iloc[:, 2] # Returns all 1.0

df.iloc[:, 0] = df.iloc[:, 0].fillna(df.iloc[:, 1])

df.iloc[:, 2] # Column 2 is corrupted and returns all NaN
@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Difficulty Intermediate labels Feb 16, 2016
@jreback jreback added this to the Next Major Release milestone Feb 16, 2016
@jreback
Copy link
Contributor

jreback commented Feb 16, 2016

hmm, that appears to be the case. pull-requests to investigate are welcome. Duplicate column support should work, though not as complete as more standard unique support.

@gfyoung
Copy link
Member

gfyoung commented Feb 22, 2016

@jreback : Where would the potentially offending code be located?

@jreback
Copy link
Contributor

jreback commented Feb 22, 2016

core/generic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants