What's the fastest way to pickle a pandas DataFrame?

后端 未结 2 1898
北荒
北荒 2021-02-19 19:25

Which is better, using Pandas built-in method or pickle.dump?

The standard pickle method looks like this:

pickle.dump(my_dataframe, open(\'t         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-19 19:36

    Easy benchmark, right?

    Not difference at all, in fact I expect that Pandas implements getstate so that calling pickle.dump(df) is actually the same as calling df.to_pickle().

    If you search for example __getstate__ on the Pandas source code, you will find that it is implemented on several objects.

提交回复
热议问题