Pandas DataFrame FutureWarning
import pandas as pd
df = pd.read_csv('sample.csv')
df.median()
or
df.corr()
[ Error message ]
---------------------------------------------------------------------------------------------------------------------------------
<ipython-input-27-e41201014d8f>:1: FutureWarning: The default value of numeric_only in DataFrame.median is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.
---------------------------------------------------------------------------------------------------------------------------------
or
---------------------------------------------------------------------------------------------------------------------------------
<ipython-input-24-49b3fcfeb4d1>:1: 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.
---------------------------------------------------------------------------------------------------------------------------------
or
---------------------------------------------------------------------------------------------------------------------------------
<stdin>:1: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.
---------------------------------------------------------------------------------------------------------------------------------
[ Solve ]
Select only valid columns or set numeric_only=True.
df[["english", "math"]].median()
or
df.median(numeric_only=True)
df[["english", "math"]].corr()
df.corr(numberic_only=True)