pydata/pandas — pull request #6299 by jreback (2014-02-07 22:02:01+00:00)
Title: API: allow the iloc indexer to run off the end and not raise IndexError (GH6296)

closes #6296

Here's the behavior
I left it raising an ``IndexError`` if a single indexer is given that is out-of-bounds (consistent with the way ``ix/loc`` would work)

```
In [1]: df = DataFrame(np.random.randn(5,2),columns=list('AB'))

In [2]: df
Out[2]:
A B
0 1.105982 0.309531
1 -0.619102 -0.002967
2 -0.817371 0.270714
3 1.569206 1.595204
4 0.276390 -1.316232

[5 rows x 2 columns]

In [3]: df.iloc[[4,5,6]]
Out[3]:
A B
4 0.27639 -1.316232

[1 rows x 2 columns]

In [4]: df.iloc[4:6]
Out[4]:
A B
4 0.27639 -1.316232

[1 rows x 2 columns]

In [5]: df.iloc[:,2:3]
Out[5]:
Empty DataFrame
Columns: []
Index: [0, 1, 2, 3, 4]

[5 rows x 0 columns]

In [6]: df.iloc[:,1:3]
Out[6]:
B
0 0.309531
1 -0.002967
2 0.270714
3 1.595204
4 -1.316232

[5 rows x 1 columns]

In [7]: df.iloc[10]
IndexError:

```