calculates percentiles by col values - still needs cleaning