簡體   English   中英

刪除列中具有超過 5% NULL 值的所有行

[英]Drop all the rows having more than 5% NULL values in columns

我檢查了所有 NULL 值超過 5% 的列。 現在我想刪除這些列的所有行

代碼:

movies = movies.drop(movies[movies.isnull().sum(axis = 'index')/len(movies)*100 > 5],inplace = True)

print(movies)

我無法獲得預期的輸出。

你可以用thresh

df = df.dropna(axis=1 ,thresh = int(len(df)*0.95))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM