How to group by a range of values in pandas?
<p>I have a <code>dataframe</code>, which I want to group by categorical variables and a range of values. You may think of it like rows of similar values (clusters?). E.g:</p>

<pre><code>df = pd.DataFrame({'symbol' : ['IP', 'IP', 'IP', 'IP', 'IP', 'IP', 'IP'],
                   'serie' : ['A', 'B', 'A', 'B', 'A', 'B', 'B'],
                   'strike' : [10, 10, 12, 13, 12, 13, 14],
                   'last' : [1, 2, 2.5, 3, 4.5, 5, 6],
                   'price' : [11, 11, 11, 11, 11, 11, 11],
                   'type' : ['call', 'put', 'put', 'put', 'call', 'put', 'call']})
</code></pre>

<p>If I use</p>

<pre><code>grouped = df.groupby(['symbol', 'serie', 'strike'])
</code></pre>

<p>I have part of my problem solved, but I want to combine the strike values that are closer, such as 10 and 11, 12 and 13 and so forth. Preferably within a % range. </p>