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:

  • [x] Series(non_round_floats, dtype=inty) silently ignores dtype while Index raises (closed by #49609)
  • [x] Series silently returns object instead of raising with Series(np.array(["aaa"], dtype=object), dtype="datetime64[ns]") (would be closed by #49358)
  • [x] #49341 different dtype inference with pydate objects
  • [x] #49340 different dtype inference with NaT-and-other-NAs
  • [x] #49037 different inference with mixed datetime-and-ints (would be closed by #49348)
  • [ ] RangeIndex and MultiIndex cases that I'm ignoring
  • [ ] Probably subtle differences in overflow-handling in FooIndex._ensure_array
  • [x] 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.

Thoughts? cc @jorisvandenbossche @mroeschke @jreback @TomAugspurger @phofl

Comment From: jorisvandenbossche

Series(non_round_floats, dtype=inty) silently ignores dtype while Index raises

This relates very much to https://github.com/pandas-dev/pandas/issues/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)

Comment From: jbrockmendel

This relates very much to https://github.com/pandas-dev/pandas/issues/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)