【问题标题】:Merge multiple DataFrames with identical column names and different number of rows合并具有相同列名和不同行数的多个 DataFrame
【发布时间】:2020-11-17 23:31:47
【问题描述】:

给定多个数据框,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]

怎么样?

【问题讨论】:

    标签: python pandas


    【解决方案1】:
    pdList = df1.append([df2, df3, df4])
    

    【讨论】:

      猜你喜欢
      • 2020-01-02
      • 2014-01-18
      • 2014-09-28
      • 1970-01-01
      • 1970-01-01
      • 2022-10-18
      • 2019-10-22
      • 1970-01-01
      • 2013-12-08
      相关资源
      最近更新 更多