How do I create an object from two lists with repeated items?

Alimama
Alimama Member ✭
edited February 5 in Other

Hi all,

I have the following two tables:

[0,0,1,0,0,1,0] and [a,b,c,d,e,f]

and I would want the following object:

{0:[a,b,d,f],1:[c,e]}

That is, I want items in the first list to become the keys (0 and 1) and corresponding items in the other list to become the values and where the items in the first list are repeated, corresponding items in the other list are placed in a list.

I have tried within my abilities and I keep getting the following

{0:a,1:c}.

Your help would be highly appreciated. Thanks.

Answers