替换多索引数据框中的缺失值

问题描述 投票:0回答:0

在 pandas 中,如何根据每个产品填充每列的 NaN 值? 例如,我希望产品“A”列中的 NaN 填充为 0,产品“B”填充为 1,产品“C”填充为 2,依此类推。 产品“A”的“LT”列中的 NaN 填充有 3,依此类推,如上一行。you can see the dataframe that i wrote about in this picture

我尝试了“fillna”功能,但没有成功

python pandas dataframe multi-index
© www.soinside.com 2019 - 2024. All rights reserved.