dropna() got an unexpected keyword argument "thresh"为什么

from numpy import nan as NaN
import pandas as pd
se=pd.Series([4,NaN,8,NaN,5])
df=se.dropna(thresh=1)
print(df)
结果报错dropna() got an unexpected keyword argument "thresh"
有大佬可以解惑吗~

pd.Series.dropna(self, axis=0, inplace=False, how=None)就没有thresh这个参数,所以就会报错啊,如果你是用的是anaconda,那你可以输入“pd.Series.dropna?”来查看这个函数的参数和用法,你可以试一下

img

img

参数问题,你将参数去掉,如下


from numpy import nan as NaN
import pandas as pd
se=pd.Series([4,NaN,8,NaN,5])
df=se.dropna()
print(df)

img