【发布时间】:2019-05-16 08:35:43
【问题描述】:
我正在尝试使用 pandas concatenate 将数据帧列表与另一个数据帧连接起来,以用于张量流的训练功能。该列表包含未知数量的数据帧。
import pandas as pd
res_train_x = [a, b, c, d, e....]
# here each variable is a data frame. Ex: a = [], b = [], c = [] and so on
res_train_y = aa
# this is how I need the code to work
result = pd.concat([a, b, c, d, e, ..., aa], axis=0)
# my existing code
result = pd.concat([res_train_x, res_train_y], axis=0)
我在运行现有代码时收到此错误。
TypeError:无法连接类型为“”的对象;只要 pd.Series、pd.DataFrame 和 pd.Panel(已弃用)obj 有效
在与res_train_y 连接之前,我需要将列表res_train_x 分开。
【问题讨论】:
标签: python python-3.x pandas