Skip to main content

Python support for Parquet file format

Project description

https://travis-ci.org/jcrobak/parquet-python.svg?branch=master

fastparquet is a python implementation of the parquet format, aiming integrate into python-based big data work-flows.

Not all parts of the parquet-format have been implemented yet or tested e.g. see the Todos linked below. With that said, fastparquet is capable of reading all the data files from the parquet-compatability project.

Introduction

Details of this project can be found in the documentation.

The original plan listing expected features can be found in this issue. Please feel free to comment on that list as to missing items and priorities, or raise new issues with bugs or requests.

Requirements

(all development is against recent versions in the default anaconda channels)

Required:

  • numba

  • numpy

  • pandas

  • cython

Optional (compression algorithms; gzip is always available):

  • snappy (aka python-snappy)

  • lzo

  • brotli

  • lz4

  • zstandard

Installation

Install using conda:

conda install -c conda-forge fastparquet

install from pypi:

pip install fastparquet

or install latest version from github:

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

For the pip methods, numba must have been previously installed (using conda).

Usage

Reading

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

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

Since early October 2016, this fork of parquet-python has been undergoing considerable redevelopment. The aim is to have a small and simple and performant library for reading and writing the parquet format from python.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastparquet-0.6.0.post1.tar.gz (188.4 kB view hashes)

Uploaded Source

Built Distributions

fastparquet-0.6.0.post1-cp39-cp39-win_amd64.whl (306.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

fastparquet-0.6.0.post1-cp39-cp39-manylinux2010_x86_64.whl (539.5 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

fastparquet-0.6.0.post1-cp38-cp38-win_amd64.whl (304.3 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

fastparquet-0.6.0.post1-cp38-cp38-manylinux2010_x86_64.whl (546.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

fastparquet-0.6.0.post1-cp37-cp37m-win_amd64.whl (301.0 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

fastparquet-0.6.0.post1-cp37-cp37m-manylinux2010_x86_64.whl (515.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

fastparquet-0.6.0.post1-cp37-cp37m-manylinux1_x86_64.whl (515.2 kB view hashes)

Uploaded CPython 3.7m

fastparquet-0.6.0.post1-cp36-cp36m-manylinux2010_x86_64.whl (515.3 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

fastparquet-0.6.0.post1-cp36-cp36m-manylinux1_x86_64.whl (515.3 kB view hashes)

Uploaded CPython 3.6m

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page