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
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.
thresh=N
requires that a column has at least N
non-NaNs to survive. In the first example, both columns have at least one non-NaN, so both survive. In the second example, only the last column has at least two non-NaNs, so it survives, but the previous column is dropped.
Try setting thresh
to 4 to get a better sense of what's happening.