Saving Pandas DataFrame as feather file
Start your free 7-days trial now!
Consider the following Pandas DataFrame:
A int64B float64C stringD categoryE boolF datetime64[ns]dtype: object
To save the DataFrame as a feather file called test.feather in the same directory as this Python script:
Note that you need to have
pyarrow thrown installed - otherwise an error will be thrown. You can use
pip to install
pip install pyarrow
To read back the feather file
my_df = pd.read_feather("test.feather")my_df.dtypesA int64B float64C stringD categoryE boolF datetime64[ns]dtype: object
Notice how the feather file actually preserved the data types of the column - this is something we don't get using csv storage method.