Append rows to a pandas DataFrame without making a new copy

前端 未结 2 1833
野性不改
野性不改 2021-02-01 13:03

The pandas documentation includes a note:

Note Unlike list.append method, which appends to the original list and returns nothing, append here does not mod

相关标签:
2条回答
  • 2021-02-01 13:32

    See How to add an extra row to a pandas dataframe

    Upcoming pandas 0.13 version will allow to add rows through loc on non existing index data.

    Description is here and this new feature is called Setting With Enlargement.

    0 讨论(0)
  • 2021-02-01 13:33

    Why not use concat?

    df = pd.concat([df, pd.DataFrame(new_data)])
    
    0 讨论(0)
提交回复
热议问题