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.
"""Missing SettingwithCopyWarning.""" import pandas as pd df = pd.DataFrame( [["Alice", 10]], columns=pd.MultiIndex.from_product([["person"], ["first_name", "age"]]), ) df.person.age = 11 print(df)
Value 11 is not assigned. Output is
11
person first_name age 0 Alice 10
No SettingwithCopyWarning is shown.
Value 11 is assigned. Output is
person first_name age 0 Alice 11
Or: SettingwithCopyWarning is shown.
pd.show_versions()
INSTALLED VERSIONS ------------------ commit : 67a3d4241ab84419856b84fc3ebc9abcbe66c6b3 python : 3.8.6.final.0 python-bits : 64 OS : Linux OS-release : 5.3.18-lp152.44-default Version : #1 SMP Wed Sep 30 18:51:43 UTC 2020 (914f31e) machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 1.1.4 numpy : 1.19.4 pytz : 2020.4 dateutil : 2.8.1 pip : 20.3.1 setuptools : 50.3.2 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 1.3.7 lxml.etree : 4.6.2 html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : 3.3.3 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pytables : None pyxlsb : None s3fs : None scipy : 1.5.4 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : 1.2.0 xlwt : None
The text was updated successfully, but these errors were encountered:
I know that this works:
"""Workaround.""" import pandas as pd df = pd.DataFrame( [["Alice", 10]], columns=pd.MultiIndex.from_product([["person"], ["first_name", "age"]]), ) df.loc[:, ("person", "age")] = 11 print(df)
But the point of this issue is that the non-working variante should issue a warning.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
Code Sample, a copy-pastable example
Problem description
Value
11
is not assigned. Output isNo SettingwithCopyWarning is shown.
Expected Output
Value
11
is assigned. Output isOr: SettingwithCopyWarning is shown.
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: