简体   繁体   中英

Append row to an empty data frame

Can someone please explain me how I add a row to an empty data frame?

df1 = pd.DataFrame([], columns = ['abc', 'def'])
df2 = pd.DataFrame([[5, 10]], columns = ['abc', 'def'] )

df1.append(df2)
df1

Just trying to understand the example in the documentation .

df1 is still empty.

你必须像这样更新 df1

df1 = df1.append(df2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM