I have a csv file, and I have put it in a pandas dataframe:
no | data |
---|---|
1 | {"age": "30", "sex": "male"} |
2 | {"age": "26", "sex": "female"} |
I would like to create two new columns named 'age' and 'sex' (the dict. keys), then drop the original column so that it looks like this:
no | age | sex |
---|---|---|
1 | 30 | male |
2 | 26 | female |
How can I create those two new columns automatically using data from the dictionaries inside of the column 'data'?