Using the IO tools in pandas it is possible to convert a DataFrame
to an in-memory feather buffer:
import pandas as pd
from io import BytesIO
df = pd.DataFrame({'a': [1,2], 'b': [3.0,4.0]})
buf = BytesIO()
df.to_feather(buf)
However, using the same buffer to convert back to a DataFrame
pd.read_feather(buf)
Results in an error:
ArrowInvalid: Not a feather file
How can a DataFrame be convert to an in-memory feather representation and, correspondingly, back to a DataFrame?
Thank you in advance for your consideration and response.
path
which would indicate it was purposeful since all of the other methods name the variablefilepath_or_buffer
. – Lithoidbuf = io.BytesIO()
– Pardewbuf = io.BytesIO()
but I don't havefeather-format
library installed so just waiting forpip
to complete before confirming – Pardew