Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14126

pandas to_csv function changing 2d array to a single string

$
0
0

I am trying to precalculate sentence embeddings and I want to store it in a csv file, so that I can reuse it later. I create a Pandas dataframe, and I have the embeddings stored correctly as a 2d array of floats (et or the ea column).

relevant_df.head()

enter image description here

I then run the to_csv function to store this in memory. When I load this csv file, the 2d arrays have now changed into a single string. I am not being able to use the embeddings due to this

relevant_df.to_csv('relevant_docs.csv', index=False)df = pd.read_csv('relevant_docs.csv')df.head()

enter image description here

Any help will be appreciated. Thanks!


Viewing all articles
Browse latest Browse all 14126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>