Pandas 中是否有任何方法可以将 a 写入自动调整列宽DataFrame
的文件?(即类似于 Pandas在屏幕上打印 a 时所做的事情)csv
DataFrame
目前如果我这样做
df.to_csv(string_buf, sep = ' ', Index=False)
print(string_buf.getvalue())
我得到:
column1 column2 column3
0 4 james matching68 -100
1 44 george foo -500
2 14 jason trinitron -400
3 1 tom trinitron -400
4 1 lukas esp -100
顺便说一句,Index
即使我明确禁用它,它也会打印出来也很奇怪。