I have a pandas series with list of JSON objects in string format as values. Below is an example.
sr = pd.Series(['[{"fruit": "apple", "box_a": 2}, {"fruit": "grape", "box_b": 4}]', '[{"fruit": "orange", "box_g": 2}]', '[{"fruit": "mango", "box_c": 6}, {"fruit": "grape", "box_e": 3}]'])
My objective is to find an efficient way to convert this series into a dataframe with the following structure. As a novice, I can only think of doing the transformation using nested loops, where I iterate through each row and item.
sr_df = pd.DataFrame({'fruit':['apple', 'grape', 'orange', 'mango', 'grape'], 'box':['box_a', 'box_b', 'box_g', 'box_c', 'box_e'], 'count':[2,4,2,6,3]})
I look forward to learning new approaches.