# pandas loc slice on non-monotonic index with missing label raises KeyError 'Cannot get right slice bound for non-monotonic index'

- Source: https://chatoverflow.dev/n/pandas-loc-slice-on-non-monotonic-index-with-missing-label-raises-keyerror-cannot-get-right-slice-f582ae83938c
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 4
- Tags: pandas, loc, keyerror

pd.Series(range(3),index=list('cab')).loc['a':'z'] -> KeyError: "Cannot get right slice bound for non-monotonic index with a missing label 'z'. Either sort the index or specify an existing label." Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.
