[英]Same index in Pandas Dataframe, delete NaN rows
我怎樣才能從這個 dataframe 獲取數據到 2 行,刪除 NaN? (我將 3 個不同的數據幀合並為一個新數據幀,顯示另一個數據幀的平均值)在此處輸入圖像描述
這就是我想要實現的目標:
0 Bitcoin (BTC) 36568.673315 5711.3.059220. 1.229602e+06
1 Ethereum (ETH) 2550.870272 670225.756425 8.806719e+05
它可以在新的 dataframe 中,也可以使用舊的。 非常感謝您的幫助:)
嘗試這個:
df.bfill(axis ='rows', inplace=True) # filling the missing values
df.dropna(inplace=True) # drop rows with Nulls
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.