title: TypeError: unsupported operand type(s) for &: 'float' and 'numpy.float64'
body: <p>I'm trying to convert a continuous variable to a categorical variable using the following code:</p>
  
  <pre><code>def score_to_categorical(x):
      if x&lt;0.25:
          return 'very bad'
      if x&gt;=0.25 &amp; x&lt;0.5:
          return 'bad'
      if x&gt;=0.5 &amp; x&lt;0.75:
          return 'good'
      else:
          return 'very good'
  
  ConceptTemp['Score'] = ConceptTemp['Score'].apply(score_to_categorical)
  ConceptTemp1['Score'] = ConceptTemp1['Score'].apply(score_to_categorical)
  </code></pre>
  
  <p>but I get the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-72-7ec42b055d4f&gt; in &lt;module&gt;()
  ----&gt; 1 ConceptTemp['Score'] = ConceptTemp['Score'].apply(score_to_categorical)
        2 ConceptTemp1['Score'] = ConceptTemp1['Score'].apply(score_to_categorical)
  
  E:\Anaconda2\lib\site-packages\pandas\core\series.pyc in apply(self, func, convert_dtype, args, **kwds)
     2167             values = lib.map_infer(values, lib.Timestamp)
     2168 
  -&gt; 2169         mapped = lib.map_infer(values, f, convert=convert_dtype)
     2170         if len(mapped) and isinstance(mapped[0], Series):
     2171             from pandas.core.frame import DataFrame
  
  pandas\src\inference.pyx in pandas.lib.map_infer (pandas\lib.c:62578)()
  
  &lt;ipython-input-11-1c4f9c7bfafe&gt; in score_to_categorical(x)
       10     if x&lt;0.25:
       11         return 'very bad'
  ---&gt; 12     if x&gt;=0.25 &amp; x&lt;0.5:
       13         return 'bad'
       14     if x&gt;=0.5 &amp; x&lt;0.75:
  
  TypeError: unsupported operand type(s) for &amp;: 'float' and 'numpy.float64'
  </code></pre>
  
  <p>I would've though that <code>float</code> and <code>numpy.float64</code> would be compatible but that doesn't seem to be the case.</p>
  
  <p>Any help in this regard would be much appreciated. </p>
  
  <p>TIA.</p>