We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.
Get the column as a series and modify inplace with +=:
+=
In [1]: import pandas as pd ...: df = pd.DataFrame({"col": [1 ,2 ,3, 4]}) ...: s = df["col"] ...: s += 1 ...: print(s) ...: print(df["col"]) ...: print(df[["col"]]) 0 2 1 3 2 4 3 5 Name: col, dtype: int64 0 2 1 3 2 4 3 5 Name: col, dtype: int64 col 0 1 1 2 2 3 3 4
Modify the column directly with +=:
In [2]: import pandas as pd ...: df = pd.DataFrame({"col": [1 ,2 ,3, 4]}) ...: df["col"] += 1 ...: print(df["col"]) ...: print(df[["col"]]) 0 2 1 3 2 4 3 5 Name: col, dtype: int64 col 0 2 1 3 2 4 3 5
The data in the column should be consistent whether accessed as df["col"] or df[["col"]].
df["col"]
df[["col"]]
Either += modifies the values in the dataframe column or it doesn't but df["col"] and df[["col"]] should show the same values.
pd.show_versions()
In [13]: pd.show_versions() INSTALLED VERSIONS ------------------ commit : db08276bc116c438d3fdee492026f8223584c477 python : 3.8.5.final.0 python-bits : 64 OS : Darwin OS-release : 19.6.0 Version : Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 1.1.3 numpy : 1.18.5 pytz : 2020.1 dateutil : 2.8.1 pip : 20.1.1 setuptools : 47.1.0 Cython : 0.29.21 pytest : 5.4.3 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.5.2 html5lib : None pymysql : 0.10.1 psycopg2 : 2.8.6 (dt dec pq3 ext lo64) jinja2 : 2.11.2 IPython : 7.14.0 pandas_datareader: None bs4 : None bottleneck : 1.3.2 fsspec : 0.8.3 fastparquet : None gcsfs : None matplotlib : 3.3.2 numexpr : 2.7.1 odfpy : None openpyxl : 3.0.5 pandas_gbq : None pyarrow : 1.0.1 pytables : None pyxlsb : None s3fs : 0.4.2 scipy : 1.4.1 sqlalchemy : 1.3.19 tables : 3.6.1 tabulate : 0.8.7 xarray : None xlrd : None xlwt : None numba : None
For master branch:
In [1]: import pandas as pd; pd.show_versions() INSTALLED VERSIONS ------------------ commit : 9787744272c13a1dcbbcdfc7daaae8cc73ac78a3 python : 3.8.5.final.0 ... pandas : 1.2.0.dev0+684.g978774427 ...
The text was updated successfully, but these errors were encountered:
I think this might be the same as #36373
Sorry, something went wrong.
Yea. Good eye. My search didn't surface this. Thanks. Will work around and wait for the update.
Going to close as a duplicate, hopefully the fix will be out for 1.1.4
No branches or pull requests
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.
Code Sample, a copy-pastable example
Get the column as a series and modify inplace with
+=
:Modify the column directly with
+=
:Problem description
The data in the column should be consistent whether accessed as
df["col"]
ordf[["col"]]
.Expected Output
Either
+=
modifies the values in the dataframe column or it doesn't butdf["col"]
anddf[["col"]]
should show the same values.Output of
pd.show_versions()
For master branch:
The text was updated successfully, but these errors were encountered: