python - 最快/最有效的文本和 float 数据存储格式

标签 python pandas

我听说 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/

相关文章:

python - 如何修复 : TypeError 'tuple' object does not support item assignment

python - 如何从python中的列表中排序元组值

python - 拆分单元格中的文本并为标记创建额外的行

python - 如何将随机森林分类器应用于所有数据集,在 python 中一次一小部分

python - 计算并了解 Pandas 中哪些列缺少值的替代方法

javascript - 从 AJAX 或 JQuery 运行 Python 脚本

python - 是否可以在不安装 Blender 的情况下渲染 .blend 文件?

python - 如何有效地替换 pandas DataFrame 上的值?

python - 将数据帧索引转换为日期时间

python - 如何使用 python 的 httplib2 保存文件?