Karnivaurus
Karnivaurus

Reputation: 24131

Loading a Single Series from a Pickled DataFrame in Pandas

After saving a Pandas DataFrame with df.to_pickle(file_name), it can be loaded with df = pd.read_pickle(file_name). But sometimes, you may only want to load the data for one Series at a particular time, and loading the entire DataFrame is inefficient. Is there a way to load just a single Series from a pickled DataFrame?

Upvotes: 1

Views: 394

Answers (1)

Rookie
Rookie

Reputation: 305

This is not possible because pickle files are serialized and reading a single column of a serialized file is not possible. You can read a single column of other file types (i.e. h5, csv, etc.) but not a serialized file.

Upvotes: 2

Related Questions