title: How to create an numpy array of labels from a numpy array of float?
body: <p>For example, I have </p>
  
  <pre><code>arr=np.linspace(0,1,11)
  </code></pre>
  
  <p>and I want to mark numbers <code>n&lt;0.25</code> label <code>"a"</code>, <code>n&gt;0.75</code> label <code>"c"</code>, numbers between label <code>"b"</code>. the result would be </p>
  
  <pre><code>array(['a', 'a', 'a', 'b', ..., 'c'])
  </code></pre>
  
  <p>I tried things like <code>arr[arr&lt;0.25]='a'</code>, but it will only work once since there will be strings comparing with float on the next command. I can achieve this by checking its type before comparison using a for loop, but it is complicated. Is there a straight forward way to achieve this?</p>