![](/img/trans.png)
[英]How to iterate of a list of dataframe's name to get the 1st value of 1st row of every dataframe in the list
[英]fillna() only fills the 1st value of the dataframe
我面臨一個奇怪的問題,我試圖用取自另一個具有相關值的值(相同長度)的值替換 dataframe 中的所有 NaN 值。
這是我要替換值的“目標數據框”的一瞥: data_with_null
這是我想從中獲取數據的 dataframe: predicted_paticipant_groups
ticipant_groups
我試過了:
data_with_null.participant_groups.fillna(predicted_paticipant_groups.participant_groups, inplace=True)
但它只是用第一個值填充所有值 NaN 值(Infra)
是因為data_with_null
的索引都是零嗎?
重置索引並重試。
data_with_null.reset_index(drop=True, inplace=True)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.