Ah, right, I missed that this `dtype=` was going to `Index`, not to
`arange` or `asarray` or something. Disregard that comment then.


On Thu, Sep 19, 2013 at 9:45 PM, jreback <notifications@github.com> wrote:

> In pandas/tests/test_index.py:
>
> > +
> > +        # coerce mixed and float
> > +        def check(a, b, is_float_index=True):
> > +            self.assert_(a.equals(b))
> > +            if is_float_index:
> > +                self.assert_(isinstance(b, Float64Index))
> > +            else:
> > +                self.assert_(isinstance(b, Index))
> > +
> > +        check(self.mixed,Index([1.5, 2, 3, 4, 5]))
> > +        check(self.float,Index(np.arange(5) * 2.5))
> > +        check(self.float,Index(np.array(np.arange(5) * 2.5, dtype=object)))
> > +
> > +        # these don't auto convert
> > +        check(self.float,Index((np.arange(5) * 2.5), dtype=object), is_float_index=False)
> > +        check(self.mixed,Index([1.5, 2, 3, 4, 5],dtype=object), is_float_index=False)
>
> object arrays and lists are treated the same. if you specify a dtype when
> creating an Index, then it is respected (rather than auto-converted to
> Float64Index), that's all this tests. The key when using the base Index
> constructor is NOT to specify a dtype (or dtype of float)...hmm maybe test
> that.
>
> Otherwise how is the constructor to know that you really want a
> Float64Index (as you shouldn't auto convert an object dtype automatically)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pydata/pandas/pull/4850/files#r6472776>
> .
>