I have dataframe with two columns, date and Details. My details column cantinas dictionary in every cell and i have to get two values from this dictionary and store it in its own cell column.
Date Details
6/14/2022 {"number":"1","name":"John"}
6/15/2022 {"number":"2","name":"Steve"}
6/16/2022 {"number":"3","name":"Mira"}
6/17/2022 {"number":"17","name":"John"}
6/18/2022 {"number":"4","name":"Larry"}
6/19/2022 {"number":"33","name":"Bob"}
6/20/2022 {"number":"43","name":"james"}
6/21/2022 {"number":"112","name":"Joe"}
So what i need to get is dataframe with column Date as it is, column Number with numbers extracted from Details dictionary and column Name with names extracted from the Details dictionary.
I tried using these methods: 1.
df['Name'] = list(df['Details'].keys())[0]
This produces column names with all zeros in it which is wrong
2.
df['Name'] = df['Details'].apply(lambda x: x.get([0]))
This approach gives me error: AttributeError: 'str' object has no attribute 'get'
3.
df['Name'] = df['Details'].get([0])
This give me NaN
Any suggestions on how should i go about this?