Search code examples
pandasexportcategorical-data

file formats that support ordered categorical data pandas


I have tables that have several ordered categories with labels in pandas.

I wanted to know which file formats are available for exporting from pandas that support ordered categorical data.

For instance STATA tables (.DTA) supports this data type.

I know I can store and integer and store an additional reference table, but having anything stored in one file would make my file structure much cleaner and more reliable.


Solution

  • I found the solution in this link:

    https://towardsdatascience.com/the-best-format-to-save-pandas-data-414dca023e0d

    HDF5, Feather, Parquet and STATA files are suitable especially Feather. However, Feather is good for internal use within project. Parquet offers almost the same performance as feather, and also allows to load the data partially.