我使用 pandas 在 csv 文件上,我遇到此错误,我该怎么办?

Im on a csv file using pandas and i have this error what do i do?

提问人:Idobuv 提问时间:10/7/2023 最后编辑:BarmarIdobuv 更新时间:10/7/2023 访问量:25

问:

我在 CSV 文件上,我使用 pandas,我不知道我的代码有什么问题

df.describe([maximum]['Price(USD)'])
<>:1: SyntaxWarning: list indices must be integers or slices, not str; perhaps you missed a comma?
<>:1: SyntaxWarning: list indices must be integers or slices, not str; perhaps you missed a comma?
<ipython-input-70-6f9ec0183b49>:1: SyntaxWarning: list indices must be integers or slices, not str; perhaps you missed a comma?
  df.describe([maximum]['Price(USD)'])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-70-6f9ec0183b49> in <cell line: 1>()
----> 1 df.describe([maximum]['Price(USD)'])

TypeError: list indices must be integers or slices, not str
python 数据帧 分组 read.csv pandas-datareader

评论

0赞 Barmar 10/7/2023
如果保存 DataFrame 的变量是 ,则语法为 。你不要把变量放在里面。maximummaximum['Price(USD)'][]
0赞 Idobuv 10/7/2023
“builtin_function_or_method”对象不可下标,这是我得到的错误
0赞 Barmar 10/7/2023
这意味着这是一个函数,而不是一个数据帧。如果函数返回 df,请使用 .这一切都只是猜测,因为您没有提供最小的可重现示例maximummaximum()['Price(USD)']

答: 暂无答案