I have basically the same problem of this guy: How can I get a string column that look like a dictionary and get the last item of it?. However, instead of getting the last number, I need the index. Which is not actually an index, but a string.
As shown in data, 'col_B' contains a list of strings.
Any ideas?
data =\
{'col_A': ['AA', 'BB', 'CC'],
'col_B': ['{"0":10,"5":13,"8":20}', '{"0":2,"3":34,"5":40,"15":100}', '{"2":5,"5":19,"15":200,"20":200,"30":340}']}
df = pd.DataFrame(data)
col_A col_B
0 AA {"0":10,"5":13,"8":20}
1 BB {"0":2,"3":34,"5":40,"15":100}
2 CC {"2":5,"5":19,"15":200,"20":200,"30":340}
I need to find a way of extracting the numbers 8, 15 and 30.