【发布时间】:2022-01-18 21:14:23
【问题描述】:
我创建了如下的DataFrame
df = pd.DataFrame({'name': imgname, 'pose': pose})
其中 imgname 是字符串列表,例如 ['image1','image2' ...] 姿势是列表的列表,例如姿势 = [array([ 55.77614093, 8.45208199, 2.69841043, 2.17110961]), 数组([ 66.61236215, 5.87653161, -31.70704038, -21.68979529])]
我使用这一行将 Dataframe 写入 csv 文件
df.to_csv('dataset.csv',index = 'False')
但是,姿势 col 被转换为带有 '\n' 和额外空格的字符串
如何将值保存为 csv 格式的数字
【问题讨论】:
-
你能给我看看你的数据框的打印输出吗?
标签: python pandas export-to-csv