'Why are my arrays in cells from pd.Dataframe typecasted to strings?

I created a pd.Dataframe with 1 np.array in each cell of the columns "time series" and "time stamps", then I saved it as a csv and opened the csv in another script. My df looks like this:

enter image description here

The weird thing is that after opening the csv again, the two columns containing arrays are typecasted to strings.

So instead of something like this [1, 2, 3], every array looks like this "[1, 2, 3]".

Before saving and re-opening, everything was fine. I saved my df like this:

gss_epochs.to_csv(path_or_buf = path + "df.csv")

and opened it like this:

gss_epochs = pd.read_csv(path + "df.csv", sep = ",")

I haven't really found a solution for my problem online. Can anyone help me with this?

Thanks a lot in advance! Merle



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source