Mar-27-2021, 10:52 AM
Hi there,
This is a dataframe with glacial lakes and their volume:
The output should look like this: (My real dataframe is much larger, so I can't do it manually)
Thank you!
This is a dataframe with glacial lakes and their volume:
data = {'Volume': ['50', '100', '100', '90', '60', '200', '150', '80', '70'], 'GlacierID': ['a', 'a', 'b', 'b', 'c', 'd', 'd', 'd', 'e']} dataframe= pd.DataFrame(data, columns = ['Volume', 'GlacierID'])I would like to create a third column 'LakeID' assigning every value a new ID, which is composed of 'GlacierID' and an extra number according to the number of lakes. Ideally the largest volume gets number 1.
The output should look like this: (My real dataframe is much larger, so I can't do it manually)
Volume GlacierID LakeID 0 50 a a2 1 100 a a1 2 100 b b1 3 90 b b2 4 60 c c1 5 200 d d1 6 150 d d2 7 80 d d3 8 70 e e1I really don't have any idea how to do this so I cannot include any further coding.
Thank you!