Append an empty row in dataframe using pandas

前端 未结 8 1980
忘了有多久
忘了有多久 2021-02-01 13:25

I am trying to append an empty row at the end of dataframe but unable to do so, even trying to understand how pandas work with append function and still not getting it.

8条回答
  •  悲哀的现实
    2021-02-01 14:04

    You can add a new series, and name it at the same time. The name will be the index of the new row, and all the values will automatically be NaN.

    df.append(pd.Series(name='Afterthought'))
    

提交回复
热议问题