title: How to fill missing values based on grouped average?
body: <p>My data has missing values for 'Age' and I want to replace them by average based on groupby column 'Title'. After the command:</p>
  
  <pre><code>df.groupby('Title').mean()['Age']
  </code></pre>
  
  <p>I get a list for example </p>
  
  <p>Mr 32</p>
  
  <p>Miss 21.7</p>
  
  <p>Ms 28 </p>
  
  <p>etc.</p>
  
  <p>I tried:</p>
  
  <pre><code>df['Age'].replace(np.nan, 0, inplace=True)
  df[(df.Age==0.0)&amp;(df.Title=='Mr')]
  </code></pre>
  
  <p>to just see the cells where age is missing and title is of one type but it doesn't work.</p>
  
  <p>Question 1. Why the code above doesn't show any cells, despite multiple cells satisfying both conditions at the same time (age = 0.0 and title is mr)</p>
  
  <p>Question2. How can I replace all missing values based on the group average as described above?</p>