I have two Python scripts, one that creates a .csv
file and the other one that reads it.
This is how I save the dataframe in the first file:
df['matrix'] = df['matrix'].apply(lambda x: np.array(x))
df.to_csv("Matrices.csv", sep=",", index=False)
The type and shape of df['matrix'].iloc[0]
is <class 'numpy.ndarray'>
and (24, 60)
respectively.
In the second script when I try
print ("type of df['matrix'].iloc[0]", type(df['matrix'].iloc[0]))
The output is type of df['matrix'].iloc[0] <class 'str'>
How can I make sure that df['matrix']
doesn't loose its nature?