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
df=pd.DataFrame(columns=['a', 'b', 'b'])
df['a'] =list(range(5)) # Same as expected output belowdf=pd.DataFrame(columns=['a', 'b', 'b'])
df.a=list(range(5)) # Same as expected output below
Setting on new column name is okay:
df=pd.DataFrame(columns=['a', 'b', 'b'])
df.loc[:, 'c'] =list(range(5))
# a b b c# 0 NaN NaN NaN 0# 1 NaN NaN NaN 1# 2 NaN NaN NaN 2# 3 NaN NaN NaN 3# 4 NaN NaN NaN 4
Expected Output
a b b
0 0 NaN NaN
1 1 NaN NaN
2 2 NaN NaN
3 3 NaN NaN
4 4 NaN NaN
Output of pd.show_versions()
Output:
INSTALLED VERSIONS
commit : 122d502
python : 3.9.0.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 11, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : English_Singapore.1252
rhshadrach
added
Indexing
Related to indexing on series/frames, not to indexes themselves
and removed
Needs Triage
Issue that has not been reviewed by a pandas team member
labels
Dec 27, 2020
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Originally posted on StackOverflow.
Possibly related to #15695 (the traceback looks different though)
Code Sample, a copy-pastable example
Traceback:
Problem description
It works with no duplicated column:
These work even with duplicated column names:
Setting on new column name is okay:
Expected Output
Output of
pd.show_versions()
Output:
INSTALLED VERSIONS
commit : 122d502
python : 3.9.0.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 11, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : English_Singapore.1252
pandas : 1.3.0.dev0+83.g122d50246.dirty
numpy : 1.19.4
pytz : 2020.4
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.2.1
Cython : 0.29.21
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: