聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长

Fix “unsupported-assignment-operation” error for Pandas

2022-07-05 12:35 浏览: 856742 次 我要评论(0 条) 字号:

When using pylint to check my code, it reported an error:

E1137: 'df' does not support item assignment (unsupported-assignment-operation)

for the origin code:

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"


网友评论已有0条评论, 我也要评论

发表评论

*

* (保密)

Ctrl+Enter 快捷回复