thresh in dropna for DataFrame in pandas in python

后端 未结 2 932
抹茶落季
抹茶落季 2020-12-03 18:14
df1 = pd.DataFrame(np.arange(15).reshape(5,3))
df1.iloc[:4,1] = np.nan
df1.iloc[:2,2] = np.nan
df1.dropna(thresh=1 ,axis=1)

It seems that no nan va

2条回答
  •  青春惊慌失措
    2020-12-03 18:43

    Thresh=1 means that it keeps the columns which atleast contain 1 NON NA-value. Thresh=2 means that it keeps the columns which atleast contain 2 NON NA-value.

    In your case thresh is 1 and all the columns contains atleast 1 NON Na value. Hence no row is deleted.

提交回复
热议问题