我有一个DataFrames列表(名为temp
),我希望将每个DataFrame保存在一个唯一的JSON文件中,并在DataFrame列中为该文件命名为字符串值' symbol&#39 ;
我的方法是:
temp[i].to_json(temp[i][[temp[i]['symbol']] + '.txt') for i in
temp.symbol.unique()
但是我收到以下错误:
SyntaxError: invalid syntax
答案 0 :(得分:0)
“符号”列中的字符串值是什么意思?第一行的价值?如果是这样,解决方案是:
for df in temp: df.to_json(df.symbol.values[0] + '.txt')