如何将 csv 转换为 pickle?
How can I convert csv to pickle?
我有一些 csv 文件需要很长时间才能作为数据框加载到我的工作区中。有没有一种快速简便的工具可以将它们转换为 pickle 以更快地加载?
使用 Pandas 加载数据后,
使用以下内容:
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
我有一些 csv 文件需要很长时间才能作为数据框加载到我的工作区中。有没有一种快速简便的工具可以将它们转换为 pickle 以更快地加载?
使用 Pandas 加载数据后, 使用以下内容:
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