API: Index vs Series constructor alignment · Issue #49372 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@jbrockmendel

Description

@jbrockmendel

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.

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