如何 select 列表中只有 6 列的数据框

How to select dataframes that only have 6 columns from a list

我有一个列不同的数据框列表。我只想 select 仅具有特定 6 列的数据帧并连接。

df=pd.DataFrame(list, columns=['0'])

这为我提供了列表中每个数据框的一列。

IIUC

l = [df for df in dfs if df.columns.size == 6]

然后

pd.concat(l)