title: Create list from pandas dataframe for distinct values in a column
body: <p>From the following Pandas dataframe. </p>
  
  <pre><code>df = pd.DataFrame({'Id': [102,102,102,303,303,944,944,944,944],'A':[1.2,1.2,1.2,0.8,0.8,2.0,2.0,2.0,2.0],'B':[1.8,1.8,1.8,1.0,1.0,2.2,2.2,2.2,2.2],
                    'A_scored_time':[10,25,0,33,0,40,0,90,0],'B_scored_time':[0,0,30,0,41,0,75,0,95]})
  </code></pre>
  
  <p>I was trying to create lists deriving from the combinations of <code>['A_scored_time','B_scored_time']</code>, to obtain the following lists corresponding with unique <code>Id</code>:</p>
  
  <pre><code>Id(102) = A_Time = [10,25],      B_Time = [30]
  Id(303) = A_Time = [33],         B_Time = [41]
  Id(944) = A_Time = [40,90],      B_Time = [75,95]
  </code></pre>
  
  <p>This lists will be applied in the function below.</p>
  
  <pre><code>x1 = [1,0,0] 
  x2 = [0,1,0] 
  x3 = [0,0,1]
  
  k = 100 # constant
  total_timeslot = 100 # same as k
  A_Time = []  
  B_Time = [] 
  </code></pre>
  
  <p>For i in range(distinct Id), df has 3 distinct Id here. For each i the probability array y. </p>
  
  <pre><code>y = np.array([1-(A + B)/k, A/k, B/k])  
  
  
  def sum_squared_diff(x1, x2, x3, y):
      ssd = []
      for k in range(total_timeslot):  
          if k in A_Time:
              ssd.append(sum((x2 - y) ** 2))
          elif k in B_Time:
              ssd.append(sum((x3 - y) ** 2))
          else:
              ssd.append(sum((x1 - y) ** 2))
      return ssd
  </code></pre>
  
  <p>The output will be an array of len k. Once I acquire this, I will sum all n(n distinct Id) arrays. Which is what I'm after.<br>
  The outcome for <code>df</code> is:</p>
  
  <pre><code>Id(102) = sum(sum_squared_diff(x1, x2, x3, y))  =5.872800000000018
  Id(303) = sum(sum_squared_diff(x1, x2, x3, y))  = 3.9407999999999896
  Id(944) = sum(sum_squared_diff(x1, x2, x3, y))  =7.760800000000006
  </code></pre>
  
  <p>Giving <code>toatl sum = 17.574400000000015.</code> </p>