使用平均值插補並填入遺漏值
當你要進行分析時,通常會使用你自己的資料。資料集經常包含一些遺漏值。此練習要讓你練習插補這些遺漏值。插補遺漏值很重要,因為你不希望遺漏值成為分析的阻礙。
pandas 已以別名 pd 載入,NumPy 已以別名 np 載入。已為你載入名為 dataset 的 pandas DataFrame。它包含欄位 "Total Current Liabilities",其中有一些遺漏值。
本練習屬於課程
使用 Python 分析財務報表
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Impute missing value using average non-missing values by company
impute_by_company = dataset.____
# Impute missing value using average non-missing values by industry
impute_by_comp_type = dataset.____
print(impute_by_company)
print(impute_by_comp_type)