当尝试使用 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)