Create and Read Pickle Files in Python
insights Stats
warning Please login first to view stats information.
Raymond
Code Snippets & Tips
Code snippets and tips for various programming languages/frameworks. All code examples are under MIT or Apache 2.0 license unless specified otherwise.
Pickle files are commonly used Python data related projects. This article shows how to create and load pickle files using Pandas.
Create pickle file
import pandas as pd import numpy as np file_name="data/test.pkl" data = np.random.randn(1000, 2) # pd.set_option('display.max_rows', None) df = pd.DataFrame(data=data, columns=['foo', 'bar']) print(df) df.to_pickle(file_name)
Read pickle file
import pandas as pd import numpy as np file_name="data/test.pkl" df2 = pd.read_pickle(file_name) print(df2)
info Last modified by Administrator 5 years ago
copyright
This page is subject to Site terms.
comment Comments
No comments yet.