The first change makes .loc follow rational rules, the second (that removes
float truncation) makes .iloc follow rational rules. After both together,
there's only one possible interpretation of s.ix[2.0:5.0] or s.ix[2.0:5] --
if treated as .iloc, these are errors, but when treated as .loc, they're
valid, so they must be .loc.

And yeah, .ix[2:5] is a really annoying case so hooray for .loc and .iloc,
but we can't change it so not much to say about it in this PR.


On Mon, Sep 16, 2013 at 10:07 PM, jreback <notifications@github.com> wrote:

> In pandas/tests/test_indexing.py:
>
> > +        result3 = s.loc[2.0:5]
> > +        result4 = s.loc[2.1:5]
> > +        assert_series_equal(result1, result2)
> > +        assert_series_equal(result1, result3)
> > +        assert_series_equal(result1, result4)
> > +
> > +        # these provide inconcistent slicing semantics with floating
> > +        s[2:5]
> > +        s[2.0:5.0]
> > +        s[2.0:5]
> > +        s[2.1:5]
> > +
> > +        s.ix[2:5]
> > +        s.ix[2.0:5.0]
> > +        s.ix[2.0:5]
> > +        s.ix[2.1:5]
>
> tempted to make the .ix cases the same (e.g. fix (11)).
>
> again s.ix[2:5] is the reason we have iloc/loc.
>
> In [9]: s.ix[2:5]
> Out[9]:
> 5.0     2
> 7.5     3
> 10.0    4
> dtype: int64
>
> In [10]:  s.ix[2.0:5.0]
> Out[10]:
> 2.5    1
> 5.0    2
> dtype: int64
>
> In [11]: s.ix[2.0:5]
> Out[11]:
> 5.0     2
> 7.5     3
> 10.0    4
> dtype: int64
>
> In [12]: s.ix[2.1:5]
> Out[12]:
> 2.5    1
> 5.0    2
> dtype: int64
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pydata/pandas/pull/4850/files#r6389479>
> .
>