合并具有相同列名和不同行数的多个DataFrame

时间:2020-07-28 13:45:02

标签: python pandas

给出多个数据框df1,df2,df3,df4 ...具有相同的列名,只是行数不同,例如:

Data columns (total 4 columns):
Name               23 non-null object
Team               23 non-null object
Games              23 non-null int64
Average(Points)    23 non-null float64
dtypes: float64(1), int64(1), object(2)
memory usage: 864.0+ bytes
None (23, 4)
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 69 entries, 0 to 68
Data columns (total 4 columns):
Name               69 non-null object
Team               69 non-null object
Games              69 non-null int64
Average(Points)    69 non-null float64
dtypes: float64(1), int64(1), object(2)

我要合并,还是加入?

pdList = [df1, df2, df3, df4]

怎么办?

1 个答案:

答案 0 :(得分:0)

pdList = df1.append([df2, df3, df4])