I'm new to Mathematica so please bare with me!
I wish to split an imported data list off of {x,y} values based off the y value, and then sum the corresponding parts.
An example of the imported list:
MyDataList = {{{20, "a"}, {3, "a"}, {4,"a"}, {6, "b"}, {10, "a"}, {12, "b"}, {2, "a"}}}
I want to make 2 sublists e.g.:
AList = {{20, "a"}, {3, "a"}, {4,"a"},{10, "a"},{2, "a"}}
BList = {{6,"b"},{12,"b"}}
And then sum the numerical parts of the list, e.g.:
AList = 39
Blist = 18
I've tried GatherBy and SplitBy to try and partition but it doesn't quite split how I need. Any advice would be super helpful!
MyDataListas you provided in the question, and it should work. – Domen Mar 20 '23 at 21:24