My dataframe:
df:
order quantity
A 1
B 1
C 2
D 3
E 3
F 4
My goal is to create a group from this Dataframe based on the Quantity value. My desired result.
df:
group order quantity
1 A 1
B 1
C 2
2 D 3
E 1
3 E 2
F 2
4 F 2
So here my desired result is based on quantity. Max value of quantity is 4.
In group1, group2 &group3 the total values (A+B+C=4)(i.e keeping the max vale of quantity as 4).
In group4 we can see that no values to add so the group is formed by the left over(here it is 2).
In group2&group3 you can see the value of E and F are divided.
So in future I can select the group by its name or number.
Note:
My actual order(column["order"]) looks like this "PMC11-AA1L1PAVWJJ+Z1"
its a string.
Is this possible in python. If so kindly suggest me the method. I could practice and learn.