Open
Description
If you combine two Index objects using append
, if they are both object dtype to start with, it seems we still infer the dtype for the result instead of preserving object dtype:
idx1 = pd.Index(["b", "a"], dtype=object)
idx2 = pd.Index(["c", "d"], dtype=object)
>>> idx1.append(idx2)
Index(['b', 'a', 'c', 'd'], dtype='object')
>>> pd.options.future.infer_string = True
>>> idx1.append(idx2)
Index(['b', 'a', 'c', 'd'], dtype='str') # <-- upcast to string
I would expect that to preserve the dtype of the calling / passed Index (or at least its "common" dtype, which in this case clearly is object dtype)