I have a list of tuples [(val1, freq1), (val2, freq2) .... (valn, freqn)]
. I need to get measures of central tendencies (mean, median ) and measures of deviation (variance , std) for the above data.I would also like to plot a boxplot for the values.
I see that numpy arrays have direct methods for getting mean / median and standard deviation (or variance) from list of values.
Does numpy (or any other well-known library) have a direct means to operate on such a frequency distribution table ?
Also: What is the best way to programmatically expand the above list of tuples to one list? (e.g if freq dist is [(1,3) , (50,2)]
, best way to get a list [1,1,1,50,50]
to use np.mean([1,1,1,50,50])
)?
I see a custom function here, but I would like to use a standard implementation if possible.