title: Convert numerical data to categorical in Python
body: <p>I have a pandas dataframe with the column fert_Rate for fertility rate. I want to have a new column with these values as categorical instead of numerical. Instead of 1.0, 2.5, 4.0 I want something like (low, medium, high). In R I would have written something like this:</p>
  <pre><code>attach(mydata)
  mydata$fertcat[fert_Rate &gt; 3.5] &lt;- &quot;High&quot;
  mydata$fertcat[fert_Rate &gt; 2 &amp; fert_Rate &lt;= 3.5] &lt;- &quot;Medium&quot;
  mydata$fertcat[fert_Rate &lt;= 2] &lt;- &quot;Low&quot;
  detach(mydata)
  </code></pre>
  <p>Is there a similar way to do it in python or should I just loop over the column to create?</p>