Get rows from DataFrame based on array of indices
<p>I have an array with numbers which corresponds to the row numbers that need to be selected from a DataFrame. 
For example, <code>arr = np.array([0,0,1,1])</code> and the DataFrame is seen below. <code>arr</code> is the row number and not the index. </p>

<pre><code>Index   A   B   C   D
3      10   0   0   0
4      5    2   0   0
</code></pre>

<p>Using <code>arr</code> I would like to produce a DataFrame that looks like this </p>

<pre><code>  Index    A    B   C   D
    3      10   0   0   0
    3      10   0   0   0
    4      5    2   0   0
    4      5    2   0   0
</code></pre>

<p>You can use <code>iloc</code> with integer indexing:</p>

<pre><code>df.iloc[[0,0,1,1], :]   # or df.iloc[arr, :]

#    A  B   C   D
#Index              
#3  10  0   0   0
#3  10  0   0   0
#4   5  2   0   0
#4   5  2   0   0
</code></pre>

python arrays pandas dataframe