I have this Dataframe
temp = pd.DataFrame({'Person': ['P1', 'P2'], 'Dictionary': [{'value1': 0.31, 'value2': 0.304}, {'value2': 0.324}]})
Person Dictionary
0 P1 {'value1': 0.31, 'value2': 0.304}
1 P2 {'value2': 0.324}
I want an output in this format:
temp1 = pd.DataFrame({'Person': ['P1', 'P1', 'P2'], 'Values_Number': ['value1', 'value2', 'value2'], 'Values': [0.31, 0.304, 0.324]})
I tried using this:
temp['Dictionary'].apply(pd.Series).T.reset_index()
Person Values_Number Values
0 P1 value1 0.310
1 P1 value2 0.304
2 P2 value2 0.324
But i am not able to concat this with the previous Dataframe. Also, we would be chances of error.