title: NumPy array to bounded by 0 and 1?
body: <p>Basically I have an array that may vary between any two numbers, and I want to preserve the distribution while constraining it to the [0,1] space. The function to do this is very very simple. I usually write it as:</p>
  
  <pre><code>def to01(array):
      array -= array.min()
      array /= array.max()
      return array
  </code></pre>
  
  <p>Of course it can and should be more complex to account for tons of situations, such as all the values being the same (divide by zero) and float vs. integer division (use np.subtract and np.divide instead of operators). But this is the most basic.</p>
  
  <p>The problem is that I do this very frequently across stuff in my project, and it seems like a fairly standard mathematical operation. Is there a built in function that does this in NumPy?</p>