Jean
Jean

Reputation: 23

How can I convert csv to pickle?

I have some csv files which take a bit long to load as dataframe into my workspace. Is there a fast and easy tool to convert them to pickle to load faster?

Upvotes: 1

Views: 14561

Answers (1)

Mohana
Mohana

Reputation: 489

After you load the data using Pandas, Use the following:

import pandas as pd
df.to_pickle('/Drive Path/df.pkl')    #to save the dataframe, df to 123.pkl
df1 = pd.read_pickle('/Drive Path/df.pkl') #to load 123.pkl back to the dataframe df

Upvotes: 1

Related Questions