You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There has been long-running interest in aligning the behaviors of various constructors: e.g. #29973, #27460, #17246. But I don't see an issue that is specifically "Let's make Index behave like Series". So here goes.
Series goes through sanitize_array which calls a bunch of functions in core.dtypes.cast. Index uses casting/inference functions in indexes.base, as well as Index._ensure_array.
Probably subtle differences in overflow-handling in FooIndex._ensure_array
Deprecated (TODO: GH ref) Index inference of numeric dtype with ndarray[object-of-all-numbers]
(recently enforced deprecations including #49319, #49242, #48379 cut down on this a ton)
The first entry here (handling of non-round floats with inty dtype) would be the most invasive to align. The current Series behavior was in place before I got involved, so I'm not aware of the reasoning behind it. I'd be on board with deprecating it and changing it in 3.0.
Series(non_round_floats, dtype=inty) silently ignores dtype while Index raises
This relates very much to #45588, where I am arguing that we should change the casting / Series() behaviour to raise on float truncation (and essentially match what Index already does, apparently)
This relates very much to #45588, where I am arguing that we should change the casting / Series() behaviour to raise on float truncation (and essentially match what Index already does, apparently)
Good point. Is there a viable strategy of addressing just Series(floaty, dtype=inty) without resolving all of #45588? Would doing so help cut down on the scope of that? (IIRC the scope there was somewhat daunting)
There has been long-running interest in aligning the behaviors of various constructors: e.g. #29973, #27460, #17246. But I don't see an issue that is specifically "Let's make Index behave like Series". So here goes.
Series goes through
sanitize_array
which calls a bunch of functions in core.dtypes.cast. Index uses casting/inference functions in indexes.base, as well asIndex._ensure_array
.The remaining behavior differences AFAICT are:
(recently enforced deprecations including #49319, #49242, #48379 cut down on this a ton)
The first entry here (handling of non-round floats with inty dtype) would be the most invasive to align. The current Series behavior was in place before I got involved, so I'm not aware of the reasoning behind it. I'd be on board with deprecating it and changing it in 3.0.
Thoughts? cc @jorisvandenbossche @mroeschke @jreback @TomAugspurger @phofl
The text was updated successfully, but these errors were encountered: