How to save a Pandas DataFrame in Parquet format

1 min

Sometimes, you will need to save a DataFrame in Parquet format, either to share it or store it.

Why Parquet?

Parquet has been created to efficiently compress and store data big amounts of data.

Here is how to save a DataFrame in Parquet format.

# Import the Pandas library
import pandas as pd

# We create our example dataframe
df = pd.DataFrame({"col1" : range(0,10)})

# We save the dataframe as parquet
df.to_parquet('my_df.parquet.gzip', compression="gzip")
How to save a DataFrame in Parquet format

Here you are! You now know how to save a DataFrame in Parquet format!

More on DataFrames

If you want to know more about DataFrame and Pandas. Check out the other articles I wrote on the topic, just here :

Pandas - The Python You Need
We gathered the only Python essentials that you will probably ever need.