Place x,y coordinates into bins
<p>I have a Pandas dataframe with two of the columns containing x,y coordinates that I plot as below:</p>

<pre><code>plt.figure(figsize=(10,5))
plt.scatter(df.x, df.y, s=1, marker = ".")
plt.xlim(-1.5, 1.5)
plt.ylim(0, 2)
plt.xticks(np.arange(-1.5, 1.6, 0.1))
plt.yticks(np.arange(0, 2.1, 0.1))
plt.grid(True)
plt.show()
</code></pre>

<p><a href="https://i.stack.imgur.com/3kEuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3kEuy.png" alt="enter image description here"></a></p>

<p>I want to split the x and y axes every 0.1 units to give 600 bins (30x20).  Then I want to know how many of my points are in each bin and the indices of these points so I can look them up in my dataframe.  I basically want to create 600 new dataframes for each bin.</p>

<p>This is what I've tried so far:</p>

<pre><code>df[(df.x &gt;= -0.1) &amp; (df.x &lt; 0) &amp; (df.y &gt;= 0.7) &amp; (df.y &lt; 0.8)]
</code></pre>

<p>This will give me part of the dataframe contained within the square (-0.1 ≤ x &lt; 0) &amp; (0.7 ≤ y &lt; 0.8).  I want a way to create 600 of these.</p>