title: pandas cut with infinite upper/lower bounds
body: <p>The <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.cut.html" rel="noreferrer">pandas <code>cut()</code> documentation</a> states that: &quot;Out of bounds values will be NA in the resulting Categorical object.&quot; This makes it difficult when the upper bound is not necessarily clear or important. For example:</p>
  <pre><code>cut (weight, bins=[10,50,100,200])
  </code></pre>
  <p>Will produce the bins:</p>
  <pre><code>[(10, 50] &lt; (50, 100] &lt; (100, 200]]
  </code></pre>
  <p>So <code>cut (250, bins=[10,50,100,200])</code> will produce a <code>NaN</code>, as will <code>cut (5, bins=[10,50,100,200])</code>. What I'm trying to do is produce something like <code>&gt; 200</code> for the first example and <code>&lt; 10</code> for the second.</p>
  <p>I realize I could do <code>cut (weight, bins=[float(&quot;inf&quot;),10,50,100,200,float(&quot;inf&quot;)])</code> or the equivalent, but the report style I am following doesn't allow things like <code>(200, inf]</code>. I realize too I could actually specify custom labels via the <code>labels</code> parameter on <code>cut()</code>, but that means remembering to adjust them every time I adjust <code>bins</code>, which could be often.</p>
  <p>Have I exhausted all the possibilities, or is there something in <code>cut()</code> or elsewhere in <code>pandas</code> that would help me do this? I'm thinking about writing a wrapper function for <code>cut()</code> that would automatically generate the labels in desired format from the bins, but I wanted to check here first.</p>