Hello all, I need to create a structure where I keep track of pairs of 
value => weight so that I can do various weighted statistical calculations.

I know that StatsBase has a weights vector, which I plan on using, but the 
way that is set up is that it is disassociated from each of the values to 
which the weights are to be applied.

I need the mapping that "Pair" provides, but I've noticed that there is no 
easy way, if I have an array of pairs, to grab all the first values or all 
the second values (like you can do with a dict in grabbing keys or values).

I've tried to do something like map(first, my_array_of_pairs), but this is 
about 10x slower than if you have a dictionary of value => weight and just 
asked for the keys.  I actually tried to use a dict at first, but ran into 
issues with duplicate values (they were overwriting each other because the 
value was the key).

Any suggestions, or any better way to manipulate an array of Pairs?

Thanks!

Chris

Reply via email to