Suppose I have a pandas dataframe that looks like this:
Name Values
0 John [[15, 200], [20, 300]]
1 Sam [[16, 100], [20, 1000]]
Where the column 'Values' represents a distribution of wealth over time. For example, when John was 15 he had $200 and by the age of 20 he had $300.
I want my dataframe to look like this:
Name Age Wealth
0 John 15 200
1 John 20 300
2 Sam 16 100
3 Sam 20 1000
so that I can make use of the inbuilt functions of pandas to study my data.
I could probably create a new dataframe in my liking by iterating over each pair of values in the original 'Values' column, but that is probably not very efficient since I have a lot of data, and I wouldn't be taking advantage of pandas's functionality.
Is there a way to do this without manually creating a new dataframe from scratch? Does the new dataframe require additional space or is this negligible?