其他分享
首页 > 其他分享> > DataFrame合并数据df.append

DataFrame合并数据df.append

作者:互联网

import pandas as pd
from pandas import DataFrame

df1 = DataFrame([[1.4,2],[7.1,-4.5],
                [2,3],[0.75,-1.3]],
               columns=['one','two'])
print(df1)
df2 = DataFrame([[1.4,2],[7.1,-4.5],
                [2,3],[0.75,-1.3]],
               columns=['one','two'])
print(df2)

df3 = df1.append(df2).reset_index(drop=True)
print(df3)


 

one two
0 1.40 2.0
1 7.10 -4.5
2 2.00 3.0
3 0.75 -1.3
one two
0 1.40 2.0
1 7.10 -4.5
2 2.00 3.0
3 0.75 -1.3
one two
0 1.40 2.0
1 7.10 -4.5
2 2.00 3.0
3 0.75 -1.3
4 1.40 2.0
5 7.10 -4.5
6 2.00 3.0
7 0.75 -1.3

 

标签:7.10,1.3,df,DataFrame,0.75,2.00,1.40,append
来源: https://www.cnblogs.com/nicole-zhang/p/14432679.html