pandas-numpy压缩保存数据
numpy的保存
https://numpy.org/doc/stable/reference/generated/numpy.save.html
numpy保存数组比较简单。
1 | # 1. 保存单个数组 |
pandas的保存
pandas保存复杂得多,提供了非常多的格式,常见的:csv,xlsx,h5等。
Type | Data Description | Reader | Writer |
---|---|---|---|
text | CSV | read_csv | to_csv |
text | Fixed-Width Text File | read_fwf | NA |
text | JSON | read_json | to_json |
text | HTML | read_html | to_html |
text | LaTeX | Styler.to_latex | NA |
text | XML | read_xml | to_xml |
text | Local clipboard | read_clipboard | to_clipboard |
binary | MS Excel | read_excel | to_excel |
binary | OpenDocument | read_excel | NA |
binary | HDF5 Format | read_hdf | to_hdf |
binary | Feather Format | read_feather | to_feather |
binary | Parquet Format | read_parquet | to_parquet |
binary | ORC Format | read_orc | to_orc |
binary | Stata | read_stata | to_stata |
binary | SAS | read_sas | NA |
binary | SPSS | read_spss | NA |
binary | Python Pickle Format | read_pickle | to_pickle |
SQL | SQL | read_sql | to_sql |