首页 > 解决方案 > Python - Pd.dataframe - sum(step, []) - “只能将列表(不是“str”)连接到列表”

问题描述

我的任务是在另一台机器上运行一个脚本。我搭建了一个conda环境:Python3.6 Pandas1.0.3

系统:Ubuntu 16.04.6 Xenial

到目前为止,我只需要在脚本中将 Python2 调整为 Python3 代码,但现在我遇到了以下问题:

losses = pd.DataFrame([sum(step, []) for step in losses], colums=['Frechet Distance GAN1', 'Frechet Distance GAN2', ....]) 

我收到以下错误:

TypeError:只能将列表(不是“str”)连接到列表

我很确定反派是(sum(step, [])或某种 Python2 到 Python3 的问题。

标签: pythonpandassumconcatenation

解决方案


推荐阅读