Issue
For this dataset, i want to find the sum of Value(£) for each combination of the three columns together for Year, Length Group and Port of Landing. So for example, one sum value will be for the year 2016, the Length group 10m&Under and the Port of Landing Aberdaran.
Solution
Given the response you have back to @berkayln, I think you want to project that column back to your original dataframe... Does this suit your need ?
df['sumPerYearLengthGroupPortOfLanding']=df.groupby(['Year','Length Group','Port of Landing'])['Value(£)'].transform(lambda x: x.sum())
Answered By - Daniel Weigel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.