Skip to content

DOC: Add documentation on parquet categorical data handling #58245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2877,9 +2877,16 @@ def to_parquet(

Notes
-----
This function requires either the `fastparquet
<https://pypi.org/project/fastparquet>`_ or `pyarrow
<https://arrow.apache.org/docs/python/>`_ library.
* This function requires either the `fastparquet
<https://pypi.org/project/fastparquet>`_ or `pyarrow
<https://arrow.apache.org/docs/python/>`_ library.
* When saving a DataFrame with categorical columns to parquet,
the file size may increase due to the inclusion of all possible
categories, not just those present in the data. This behavior
is expected and consistent with pandas' handling of categorical data.
To manage file size and ensure a more predictable roundtrip process,
consider using :meth:`Categorical.remove_unused_categories` on the
DataFrame before saving.

Examples
--------
Expand Down