How to append new row to dataframe in pandas?

前端 未结 4 822
臣服心动
臣服心动 2021-02-13 19:29

This is the code i have used

    iname = \"name1\"    
    ipassword = \"password1\"
    iemail = \"email@domain.com\"
    res1 = []
            


        
4条回答
  •  不知归路
    2021-02-13 19:57

    Another simple approach is to use pd.Dataframe.loc method.

    row = [iname, ipassword, iemail]
    df.loc[len(df)] = row
    df.to_csv("login.csv", index=False)
    

提交回复
热议问题