title: How can I use the apply() function for every column with their corresponding mean value?
body: <p>I have a dataframe like below:</p>
  
  <pre><code>  rowid  user_id  col_2   bias
    0        1      0       2.1
    1        2      2       2.5
    2        3      3       3.6
    3        1      0       2.8
    4        2      2       1.5
    5        3      3       3.2
  </code></pre>
  
  <p>Now I want to let 'bias' column be the mean value of corresponding user_id,just like that for one unique user_id:</p>
  
  <pre><code> rowid  user_id  col_2   bias
    0        1      0       2.1
    3        1      0       2.8
  </code></pre>
  
  <p>to:</p>
  
  <pre><code> rowid  user_id  col_2   bias
    0        1      0       2.45
    3        1      0       2.45
  </code></pre>