-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DataFrame.assign accepts 2d arrays for single column value #51925
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
If you do it this way it works fine |
It doesn't work, and the issue seems to be Windows-specific. Are you trying to use macOS or Linux to reproduce this problem? |
Reproducible on my win10 ltsc machine. |
I am using windows 11 |
Could you please try again in a fresh environment from https://github.com/pandas-dev/pandas/blob/main/environment.yml and attach your |
I checked it today and now it's showing me the same result as yours, there is some bug. |
Thanks for the report, @determ1ne. I can confirm this problem using MacOS. >>> pd.DataFrame(data_dict)
ValueError: Per-column arrays must each be 1-dimensional So there is some checks in |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The
name
Series was assigned using a 2D ndarray, and it works fine. But aDataFrame.copy
makesname
overwritevalue
andvalue2
in the new df. An 1D ndarray will not break the normal behavior.Expected Behavior
Installed Versions
Fresh install of development environment following pandas doc gave an error from numba, here's another report:
INSTALLED VERSIONS
commit : 2e218d1
python : 3.8.16.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Chinese (Simplified)_China.936
pandas : 1.5.3
numpy : 1.22.0
pytz : 2022.7
dateutil : 2.8.2
setuptools : 65.6.3
pip : 22.3.1
Cython : None
pytest : 7.2.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.9
lxml.etree : None
html5lib : None
pymysql : 1.0.2
psycopg2 : 2.9.5
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : 1.3.5
brotli :
fastparquet : None
fsspec : 2023.1.0
gcsfs : None
matplotlib : 3.6.2
numba : 0.56.4
numexpr : 2.8.4
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.10.0
snappy : None
sqlalchemy : None
tables : 3.7.0
tabulate : None
xarray : 2023.1.0
xlrd : None
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: