![](/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.