Pandas: drop columns with all NaN’s

From the dropna docstring:

Drop the columns where all elements are NaN:
df.dropna(axis=1, how='all')


   A    B    D
0  NaN  2.0  0
1  3.0  4.0  1
2  NaN  NaN  5

Leave a Comment