My data looks something like this, what i want to do now is create a new column "Mean" where i want to find the mean of "customer accepted" for all the same values in the "price" column.
  Product | Price | Customer Accepted
       A      17.2         1
       A      16.8         0
       A      17.2         1
       B      21           1
       B      16.8         0
       A      21           0
       C      17.2         0
For example, 17.2 repeats 3 times and the mean of its corresponding customer accepted values is (1+1+0/3 = 0.66); similarly for 16.8 its (0+0/2 = 0), for 21 it is (1+0/2 = 0.50); the new column, "Mean" should have these values when ever the same price repeats.
My expected output
  Product | Price | Customer Accepted | Mean
       A      17.2         1            0.66   
       A      16.8         0             0 
       A      17.2         1            0.66
       B      21           1            0.50
       B      16.8         0             0 
       A      21           0            0.50 
       C      17.2         0            0.66
There are around 950 different levels for the price value, and the number of times each value repeats is not consistent. Can somebody help me with this ? Thanks a lot