Fix “unsupported-assignment-operation” error for Pandas
source link: https://donghao.org/2022/07/05/fix-unsupported-assignment-operation-error-for-pandas/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Fix “unsupported-assignment-operation” error for Pandas
When using pylint to check my code, it reported an error:
E1137: 'df' does not support item assignment (unsupported-assignment-operation)
E1137: 'df' does not support item assignment (unsupported-assignment-operation)
for the origin code:
df["column1"] = "hello"
df["column1"] = "hello"
It looks like we have no choice but to use operation .loc
in pandas to avoid this error.
# Set all rows in "column1" to "hello" df.loc[:, "column1"] = "hello"
# Set all rows in "column1" to "hello"
df.loc[:, "column1"] = "hello"
Related Posts
- Efficient reading in pandas
My previous code was trying to read all data and get only one column that…
- pandas.datetime64 with Timezone
I barely pay attention to the pandas.datetime64 type. But yesterday a problem stroke me. It…
- 128bit atomic operation in arm64
In x86_64 architecture, we could use cmpxchg16b to compare and exchange a 128bit value in…
July 5, 2022 - 0:44
RobinDong
develop
pandas
Leave a comment
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK