thresh在
dropna()方法中使用参数。通过设置
thresh=1,您可以指定如果至少有1个非null的项目,请不要删除它。
df = pd.Dataframe(np.random.choice((1., np.nan), (1000, 1000), p=(.3, .7)))list_of_cols = list(range(10))df[list_of_cols].dropna(thresh=1).head()

thresh在
dropna()方法中使用参数。通过设置
thresh=1,您可以指定如果至少有1个非null的项目,请不要删除它。
df = pd.Dataframe(np.random.choice((1., np.nan), (1000, 1000), p=(.3, .7)))list_of_cols = list(range(10))df[list_of_cols].dropna(thresh=1).head()