Pandas loc vs iloc slicing: Inclusive vs exclusive endpoints

Pandas loc vs iloc slicing: Inclusive vs exclusive endpoints

When retrieving a slice with loc in Python Pandas, the end point is included, highly unusual in Python!

s = pd.Series([10, 20, 30, 40, 50], index=list('abcde'))
s.loc['a':'c']  # a, b, c (inclusive!)
s.iloc[0:2]     # a, b (exclusive, like Python)