我听说 CSV 最适合文本数据,而 numpy 最适合数字/ float 据。但我的 Pandas 数据框既有文本又有 float 。
我正在查看 Pandas 中可用的所有数据存储格式。
text CSV read_csv to_csv
text JSON read_json to_json
text HTML read_html to_html
text Local clipboard read_clipboard to_clipboard
binary MS Excel read_excel to_excel
binary HDF5 Format read_hdf to_hdf
binary Feather Format read_feather to_feather
binary Parquet Format read_parquet to_parquet
binary Msgpack read_msgpack to_msgpack
binary Stata read_stata to_stata
binary SAS read_sas
binary Python Pickle Format read_pickle to_pickle
SQL SQL read_sql to_sql
SQL Google Big Query read_gbq to_gbq
浮点/文本数据的最佳选择是什么?
最佳方面:减少到最小的内存量
最佳方面:最快的保存/加载时间。
最佳答案
您会对 Parquet 感到最满意。
- 它不仅在 Python 中得到了很好的支持,而且在大多数语言中也得到了很好的支持。
- 它在小数据上效果很好,并且可以很好地扩展到大型数据集。
- 写入和加载数据相对较快。
- 处理稀疏数据集。
- 也可用于压缩(gzip 等)。
- 旧简历看起来不错。
但最重要的是,它易于使用,并且您可以边操作边了解它的细节。
编辑它以添加有关该主题的博客文章以及一些基准: https://tech.jda.com/efficient-dataframe-storage-with-apache-parquet/#
关于python - 最快/最有效的文本和 float 数据存储格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55936979/