Python pandas: fill a dataframe row by row

后端 未结 4 1442
[愿得一人]
[愿得一人] 2020-12-12 12:13

The simple task of adding a row to a pandas.DataFrame object seems to be hard to accomplish. There are 3 stackoverflow questions relating to this, none of which

4条回答
  •  [愿得一人]
    2020-12-12 12:18

    My approach was, but I can't guarantee that this is the fastest solution.

    df = pd.DataFrame(columns=["firstname", "lastname"])
    df = df.append({
         "firstname": "John",
         "lastname":  "Johny"
          }, ignore_index=True)
    

提交回复
热议问题