【问题标题】:How can I convert csv to pickle?如何将 csv 转换为 pickle?
【发布时间】:2021-02-26 03:50:07
【问题描述】:

我有一些 csv 文件需要很长时间才能作为数据框加载到我的工作区中。有没有一种快速简便的工具可以将它们转换为 pickle 以加快加载速度?

【问题讨论】:

    标签: dataframe csv google-colaboratory pickle


    【解决方案1】:

    使用 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-04
      • 2014-04-23
      • 2012-04-24
      • 2018-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多