【发布时间】:2021-07-05 15:38:52
【问题描述】:
我正在尝试更新特定行和列的值
这是我想要做的:
import pandas as pd
df = pd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]],
index=[4, 5, 6], columns=['A', 'B', 'C'])
df.at(4,'A')=10 #trying to update the value of row 4 and column A
我收到如下错误,我无法弄清楚可能是什么问题
df.at(4,'A')=10
^
SyntaxError: can't assign to function call
我必须使用 .at() 来满足我的其他要求。 任何帮助/建议都非常感谢,谢谢!
【问题讨论】:
-
您需要重复您的 PANDAS 使用教程。 Stack Overflow 并不打算取代现有的文档和教程。请从intro tour 重复on topic 和how to ask。
-
好一个@Prune!如果我知道我做错了什么,我会更高兴。
-
总是有助于检查docs。
-
如我所说,请查看教程以了解正确用法。这与 Stack Overflow 无关。
标签: python python-3.x pandas dataframe