python implementation of the parquet columnar file format.
  • Python 84.9%
  • Cython 8.1%
  • Thrift 7%
Find a file
kingbri c74ba7b132 Actions: Add windows build
Signed-off-by: kingbri <bdashore3@proton.me>
2024-08-03 17:25:16 -04:00
.github/workflows Actions: Add windows build 2024-08-03 17:25:16 -04:00
ci update test versions (#895) 2023-10-25 11:16:17 -04:00
docs changelog & unpin build actions (#894) 2023-10-25 09:41:07 -04:00
fastparquet Use np.int64 type for day to nanosecond conversion (NEP50) (#922) 2024-05-07 21:35:08 -04:00
test-data Fix reading timezones from metadata (#909) 2023-12-12 11:28:57 -05:00
.coveragerc Don't force read past end of array (#545) 2021-01-12 09:53:38 -05:00
.gitattributes Evolution (#818) 2022-11-14 17:01:54 -05:00
.gitignore Builds (#822) 2022-11-17 20:33:00 -05:00
.pylintrc Fast reading; writing 2016-10-17 14:07:50 -04:00
.readthedocs.yaml RTD install 2023-08-17 16:47:17 -04:00
LICENSE add license 2013-09-02 18:57:27 +00:00
Makefile COMPAT: Update thrift (#264) 2017-12-11 10:35:15 -06:00
MANIFEST.in remove numba in favour of cython (#596) 2021-05-09 13:11:21 -04:00
pyproject.toml Use np.int64 type for day to nanosecond conversion (NEP50) (#922) 2024-05-07 21:35:08 -04:00
README.rst feat: add python 3.10 support (#736) 2022-01-26 15:55:46 -05:00
requirements.txt Use np.int64 type for day to nanosecond conversion (NEP50) (#922) 2024-05-07 21:35:08 -04:00
setup.cfg Evolution (#818) 2022-11-14 17:01:54 -05:00
setup.py update for np2 release 2024-05-21 09:56:10 -04:00

fastparquet
===========

.. image:: https://github.com/dask/fastparquet/actions/workflows/main.yaml/badge.svg
    :target: https://github.com/dask/fastparquet/actions/workflows/main.yaml

.. image:: https://readthedocs.org/projects/fastparquet/badge/?version=latest
    :target: https://fastparquet.readthedocs.io/en/latest/

fastparquet is a python implementation of the `parquet
format <https://github.com/apache/parquet-format>`_, aiming integrate
into python-based big data work-flows. It is used implicitly by
the projects Dask, Pandas and intake-parquet.

We offer a high degree of support for the features of the parquet format, and
very competitive performance, in a small install size and codebase.

Details of this project, how to use it and comparisons to other work can be found in the documentation_.

.. _documentation: https://fastparquet.readthedocs.io

Requirements
------------

(all development is against recent versions in the default anaconda channels
and/or conda-forge)

Required:

- numpy
- pandas
- cython >= 0.29.23 (if building from pyx files)
- cramjam
- fsspec

Supported compression algorithms:

- Available by default:

  - gzip
  - snappy
  - brotli
  - lz4
  - zstandard

- Optionally supported
  
  - `lzo <https://github.com/jd-boyd/python-lzo>`_


Installation
------------

Install using conda, to get the latest compiled version::

   conda install -c conda-forge fastparquet

or install from PyPI::

   pip install fastparquet

You may wish to install numpy first, to help pip's resolver.
This may install an appropriate wheel, or compile from source. For the latter,
you will need a suitable C compiler toolchain on your system.

You can also install latest version from github::

   pip install git+https://github.com/dask/fastparquet

in which case you should also have ``cython`` to be able to rebuild the C files.

Usage
-----

Please refer to the documentation_.

*Reading*

.. code-block:: python

    from fastparquet import ParquetFile
    pf = ParquetFile('myfile.parq')
    df = pf.to_pandas()
    df2 = pf.to_pandas(['col1', 'col2'], categories=['col1'])

You may specify which columns to load, which of those to keep as categoricals
(if the data uses dictionary encoding). The file-path can be a single file,
a metadata file pointing to other data files, or a directory (tree) containing
data files. The latter is what is typically output by hive/spark.

*Writing*

.. code-block:: python

    from fastparquet import write
    write('outfile.parq', df)
    write('outfile2.parq', df, row_group_offsets=[0, 10000, 20000],
          compression='GZIP', file_scheme='hive')

The default is to produce a single output file with a single row-group
(i.e., logical segment) and no compression. At the moment, only simple
data-types and plain encoding are supported, so expect performance to be
similar to *numpy.savez*.

History
-------

This project forked in October 2016 from `parquet-python`_, which was not designed
for vectorised loading of big data or parallel access.

.. _parquet-python: https://github.com/jcrobak/parquet-python