title: Imputation of missing values for categories in pandas
body: <p>The question is how to fill NaNs with most frequent levels for category column in pandas dataframe?</p>
  
  <p>In R randomForest package there is 
  <a href="http://lojze.lugos.si/~darja/software/r/library/randomForest/html/na.roughfix.html" rel="noreferrer">na.roughfix</a> option : <code>A completed data matrix or data frame. For numeric variables, NAs are replaced with column medians. For factor variables, NAs are replaced with the most frequent levels (breaking ties at random). If object contains no NAs, it is returned unaltered.</code></p>
  
  <p>in Pandas for numeric variables I can fill NaN values with :</p>
  
  <pre><code>df = df.fillna(df.median())
  </code></pre>