标签: python pandas ipython
有没有办法将DataFrame作为字符串保存到磁盘,使用IPython用来显示它的格式和对齐方式?
请注意,我想保存完整的数据帧,而不仅仅是它的摘要(即头尾)。
答案 0 :(得分:3)
IPython正在显示数据框的repr:
repr
with open(filename, 'w') as f: f.write(repr(df))