Rename “None” value in Pandas

前端 未结 1 455
无人及你
无人及你 2021-02-14 20:29

This is probably super simple but I just can not find the answer. I import data using GeoPandas from a shape file. Turn that into pandas DataFrame. I have a object

1条回答
  •  清酒与你
    2021-02-14 20:53

    The simplest thing to do is just:

    sala['N10'].replace('None', 'vcv', inplace=True)
    

    that should work.

    If they were true NaN values then calling fillna would've worked.

    e.g.

    sala['N10'].fillna(value='vcv', inplace = True)
    

    also what I suggested in my comment:

    sala.loc[sala['N10'].isnull(), 'N10'] = 'vcv'
    

    0 讨论(0)
提交回复
热议问题