dropna()

删除所有元素都为nan的列
df.dropna(axis=1, how='all')

删除任何有nan的列
df.dropna(axis=1, how='any')

删除所有元素都是nan的行
df.dropna(axis=0, how='all')

保留non-na值大于thresh的行
df.dropna(thresh=2)
ref:
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.dropna.html

results matching ""

    No results matching ""