Create and Read Pickle Files in Python

access_time 10 months ago visibility225 comment 0

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

data = np.random.randn(1000, 2)
# pd.set_option('display.max_rows', None)
df = pd.DataFrame(data=data, columns=['foo', 'bar'])

Read pickle file

import pandas as pd 
import numpy as np

df2 = pd.read_pickle(file_name)
info Last modified by Administrator at 2 months ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.

Learn more arrow_forward

More from Kontext

PySpark Read Multiple Lines Records from CSV

local_offer pyspark local_offer spark-2-x local_offer python local_offer spark-file-operations

visibility 1254
thumb_up 0
access_time 6 months ago

CSV is a common format used when extracting and exchanging data between systems and platforms. Once CSV file is ingested into HDFS, you can easily read them as DataFrame in Spark. However there are a few options you need to pay attention to especially if you source file: Has records across ...

Pandas DataFrame Plot - Pie Chart

local_offer plot local_offer pandas local_offer jupyter-notebook local_offer python local_offer pandas-plot

visibility 3101
thumb_up 0
access_time 6 months ago

This article provides examples about plotting pie chart using  pandas.DataFrame.plot  function. The data I'm going to use is the same as the other article  Pandas DataFrame Plot - Bar Chart . I'm also using Jupyter Notebook to plot them. The DataFrame has 9 records: DATE TYPE ...

local_offer Java local_offer python local_offer SQL Server

visibility 1787
thumb_up 0
access_time 6 months ago

In my previous article  Connect to SQL Server via JayDeBeApi in Python , I showed examples of using Python package jaydebeapi to connect to SQL Server via JDBC. The code was working properly. However after I reinstall Python 3.8.2 x64 version on Windows, I'm getting a new error ...

About column

Code snippets for various programming languages/frameworks.

rss_feed Subscribe RSS