I'm trying to save my pandas dataframe to feather, but I'm having some problems with values
column (It's a numpy array)...
This is my df:
name values
1 so [1, 3, 5, 6]
2 ed [54968, 9, 02]
3 jon [5, 34349, 02, ..., 345546]
When I try to save it:
with NamedTemporaryFile("w") as output_file:
df.to_feather(output_file.name)
*** ValueError: cannot serialize column 1 named values with dtype mixed
I also tried to save values
with pickle, without success...
import pickle
df['values'] = pickle.dumps(out_df['values'], protocol=0)
df.to_feather(output_file.name)
*** ValueError: cannot serialize column 1 named values with dtype bytes
I don't want to use csv
. What can I do?
Edit1
sample
column cells are representing samples of measurements. This means that the length of samples can go from hundreds to thousands of values. Thus the length of the numpy arrays is very variable.
df.dtypes
values object
name object