API/BUG: Handling Dtype Coercions in Series/Index · Issue #15832 · pandas-dev/pandas (original) (raw)

Off master (bd169d):

Case I: Overflow on int64

Index([np.iinfo(np.uint64).max-1],dtype='int64') ... OverflowError: Python int too large to convert to C long

Case II: Coercion to uint64

Index([-1], dtype='uint64') UInt64Index([18446744073709551615], dtype='uint64')

Case III: Ignoring coercion to int

Index([1, 2, 3.5], dtype=int) Float64Index([1.0, 2.0, 3.5], dtype='float64')

So we got some coercions that fail but others that work. Although all of these issues involve Index, the first two are also applicable to Series (in the last issue, it does coerce all elements to integer).

How should we handle failed coercions? Is the second case even a failure? Should iron out this.

xref #12758
xref #15187