| triplets_525k.parquet | 1.9 MB | +------------------------+---------+ 读取parquet需要额外的包,比如pyarrow或fastparquet chatgpt说pyarrow比fastparquet要快,但是我在小数据集上测试时fastparquet比pyarrow要快,但是这里建议使用pyarrow,因为pandas 2.0也是默认的使用这个
FeatureSelector是用于降低机器学习数据集的维数的工具 # pydotplus, graphviz: 可视化决策树时需要用到 # PrettyTable模块可以将输出内容如表格方式整齐地输出 # pyarrow fastparquet opencv-contrib-python \ keras \ pydotplus \ graphviz \ prettytable \ pyarrow fastparquet
缺点:需要特定的库进行读取和写入,例如 pyarrow 或 fastparquet。不如 CSV 格式通用。3. Feather:优点:与 Parquet 类似,高效且支持多种数据类型。
+ `pyarrow` 引擎始终将索引写入输出,但 `fastparquet` 仅写入非默认索引。这个额外的列可能会给那些不希望看到它的非 pandas 消费者带来问题。 这可以是`pyarrow`、`fastparquet`或`auto`中的一个。 参阅[pyarrow](https://arrow.apache.org/docs/python/)和[fastparquet](https://fastparquet.readthedocs.io/en `pyarrow>=8.0.0`支持时间间隔数据,`fastparquet>=0.1.4`支持时区感知日期时间。 这些库之间的区别在于具有不同的底层依赖关系(`fastparquet`使用`numba`,而`pyarrow`使用 C 库)。
上述代码需要注意的是要单独安装pyarrow库,否则会报错,pandas是基于pyarrow对parquet进行支持的; PS:这里没有安装pyarrow,也没有指定engine的话,报错信息中说可以安装pyarrow或者fastparquet ,但是我这里试过fastparquet加载我的parquet文件会失败,我的parquet是spark上直接导出的,不知道是不是两个库对parquet支持上有差异还是因为啥,pyarrow就可以。。。。
parquet: https://github.com/dask/fastparquet d6tflow: https://github.com/d6t/d6tflow-template 10.
def loading_into_parquet(df_dask): df_dask.to_parquet("yellow_tripdata_dask.parquet", engine="fastparquet
parquet:https://github.com/dask/fastparquet 使用 Jupyter notebook 这个结论还有一些争议——Jupyter notebook 就像 CSV
parquet:https://github.com/dask/fastparquet 使用 Jupyter notebook 这个结论还有一些争议——Jupyter notebook 就像 CSV
It is used in this guide mainly for the scanpy and anndata libraries.fastparquet is a Python library stardistconda install python=3 geopandasconda install -c conda-forge squidpyconda install -c conda-forge fastparquet
None html5lib: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.10.1 s3fs: None fastparquet
parquet: https://github.com/dask/fastparquet d6tflow: https://github.com/d6t/d6tflow-template 10.
If None then try ‘pyarrow’ and ‘fastparquet’ mode.chained_assignment warn Controls SettingWithCopyWarning
额外组件 注释 PyTables 3.8.0 hdf5 基于 HDF5 的读取 / 写入 blosc 1.21.3 hdf5 HDF5 压缩;仅适用于 conda zlib hdf5 HDF5 压缩 fastparquet extra 注释 PyTables 3.8.0 hdf5 基于 HDF5 的读取/写入 blosc 1.21.3 hdf5 HDF5 的压缩;仅在 conda 上可用 zlib hdf5 HDF5 的压缩 fastparquet 注释 PyTables 3.8.0 hdf5 基于 HDF5 的读取 / 写入 blosc 1.21.3 hdf5 HDF5 的压缩;仅在 conda 上可用 zlib hdf5 HDF5 的压缩 fastparquet 额外 注释 PyTables 3.8.0 hdf5 基于 HDF5 的读取/写入 blosc 1.21.3 hdf5 HDF5 的压缩;只在 conda 上可用 zlib hdf5 HDF5 的压缩 fastparquet
第 10 行就是用 to_parquet 做上面说的事,唯一需要注意是要选取 engin 参数为 'pyarrow' 或者 'fastparquet'。运行报错了的先装 pyarrow 工具包。
None bs4: None html5lib: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.10.1 s3fs: None fastparquet
Available options: 'auto', 'pyarrow', 'fastparquet', the default is 'auto' [default: auto] [currently Available options: 'auto', 'pyarrow', 'fastparquet', the default is 'auto' [default: auto] [currently