python中是否有任何方法可以用字符串替换数据帧中的nan

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

我的数据框的值为Na,blank等,我想将Na替换为noted(其他字符串值)我想在不更改空白单元格的情况下将from here转换为here

我已经尝试过

'''df['A']=df['A'].replace(regex=['NaN'], value='needed')'''

 ''' df['A'].replace(regex=['NA'], value='noted''''
python pandas dataframe na
1个回答
1
投票

您可以使用fillna()

fillna()
© www.soinside.com 2019 - 2024. All rights reserved.