小编Eli*_*101的帖子

尝试使用 pandas 模块在 python 中运行 ```corr()``` 时出错

当尝试使用 pandas 模块在 python 中运行该corr()方法时,出现以下错误:

FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silence this warning.
  print(df.corr())
Run Code Online (Sandbox Code Playgroud)

注意(只是为了澄清):-df是从 a 读取的数据帧的名称csv

例如:-

import pandas as pd

df = pd.read_csv('Data.csv')
print(df.corr())
Run Code Online (Sandbox Code Playgroud)

问题在于corr()引发上述错误的方法:

FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default …
Run Code Online (Sandbox Code Playgroud)

python pandas future-warning

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

future-warning ×1

pandas ×1

python ×1