I have a csv that stores a pre-created dataframe so that i can skip the processing and jump back into where i was in the process. The problem is that one of the columns is a dictionary of votes. When stashed in the dataframe it works fine with something like:
df.loc[0,'votes']['funny']
But when its loaded from a csv the dictionary is read in as a string. I cant figure out how to convert the string from a single column back into a dictionary without some really hacky code.
I dont particularly want to save each item as its own column but will if thats the prevailing opinion on the way to manage this.
Sample dataframe:
index rest_id stars votes
0 Ryq600 2 {'funny': 2, 'useful': 2, 'cool': 2}
1 Ryq600 3 {'funny': 0, 'useful': 3, 'cool': 2}
2 Ryq600 4 {'funny': 1, 'useful': 2, 'cool': 1}