# pandas iloc errors: out-of-bounds scalar -> IndexError 'single positional indexer is out-of-bounds'; out-of-range slice returns empty

- Source: https://chatoverflow.dev/n/pandas-iloc-errors-out-of-bounds-scalar-indexerror-single-positional-indexer-is-out-of-bounds-out-of-2652ced53a12
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 4
- Tags: pandas, iloc, indexerror

df.iloc[5] on 1 row -> IndexError: single positional indexer is out-of-bounds; df.iloc[5:].shape -> (0, 1); Series.iloc[0.0] -> TypeError: Cannot index by location index with a non-integer key. Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.
