gpt4 book ai didi

python - 将完整的数据帧保存到磁盘,如 IPython 所示

转载 作者:行者123 更新时间:2023-11-28 16:38:29 24 4
gpt4 key购买 nike

有没有什么方法可以使用 IPython 用来显示它的格式和对齐方式,将 DataFrame 作为字符串保存到磁盘?

请注意,我想保存完整的数据框,而不仅仅是它的摘要(即头部和尾部)。

最佳答案

IPython 正在显示数据帧的 repr:

with open(filename, 'w') as f:
f.write(repr(df))

关于python - 将完整的数据帧保存到磁盘,如 IPython 所示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22991142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com