【发布时间】:2023-03-13 12:39:01
【问题描述】:
正如问题所问,我有一本熊猫的字典 dataframes,我想保存它,以便下次启动 ipython 笔记本时不必重新采样数据。我尝试过一些在其他情况下也有效的简单方法:
import json
with open('result.json', 'w') as fp:
json.dump(d, fp)
但我得到了这个错误:
[1001 rows x 6 columns] is not JSON serializable
我认为这与我的 pandas dataframe 有关,但我们将不胜感激。
【问题讨论】:
-
为什么不使用 HDFStore?