Skip to content

Setting NaN values on DataFrame with non-unique column names #13423

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
benrifkind opened this issue Jun 10, 2016 · 1 comment
Closed

Setting NaN values on DataFrame with non-unique column names #13423

benrifkind opened this issue Jun 10, 2016 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Comments

@benrifkind
Copy link

Code Sample, a copy-pastable example if possible

Something goes wrong when I try to set a NaN value using the iloc syntax. Instead of just the entry being set, the entire row gets set.

import pandas as pd
import numpy as np
df = pd.DataFrame(np.arange(1,5).reshape(2,2), columns=["A"]*2)
# this works like expected
df.iloc[0,0] = -1
df
A A
0 -1 2
1 3 4
# this sets the entire row to NaN
df.iloc[1,0] = np.nan
df
A A
0 -1.0 2.0
1 NaN NaN
# It only seems to be an issue when indexing the first repeated column
df.iloc[0,1] = np.nan
df
A A
0 -1.0 NaN
1 NaN NaN

output of pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 21.2.2
Cython: 0.24
numpy: 1.11.0
scipy: 0.17.0
statsmodels: 0.6.1
xarray: None
IPython: 4.1.2
sphinx: 1.3.1
patsy: 0.4.0
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.5.2
matplotlib: 1.5.1
openpyxl: 2.2.6
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.7.7
lxml: 3.4.4
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.11
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.38.0
pandas_datareader: None
@jreback
Copy link
Contributor

jreback commented Jun 11, 2016

this seems to be a duplicate of #12344, fixed here: #12498

That was in 0.18.0, and this is not reproducible on 0.18.1 or master.

@jreback jreback closed this as completed Jun 11, 2016
@jreback jreback added Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Duplicate Report Duplicate issue or pull request Can't Repro labels Jun 11, 2016
@jreback jreback added this to the No action milestone Jun 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request 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

No branches or pull requests

2 participants