📜  带索引的 fillna - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:44.156000             🧑  作者: Mango

代码示例1
In [13]:
d=pd.DataFrame(index=['A','B','C'], columns=['Num','Name'], data=[[1,'Andrew'], [2, np.nan], [3, 'Chris']])
d['Name']=d['Name'].fillna(d.index.to_series())
d

Out[13]:
   Num    Name
A    1  Andrew
B    2       B
C    3   Chris