BUG/API: Index/Series concat inconsistencies · Issue #13626 · pandas-dev/pandas (original) (raw)

xref #7795 #13221. Series/Index concat-like op which triggers object-coercion is not well tested. Followings are needed:

Code Sample, a copy-pastable example if possible

Found some problems below:

# NG. though it looks OK, the objects are python built-in (must be Timestamp and Timedelta)
s = pd.Series([pd.Timestamp('2011-01-01')]).append(pd.Series([pd.Timedelta('1 days')]))
s
#0    2011-01-01 00:00:00
#0         1 day, 0:00:00
# dtype: object

type(s.iloc[0]), type(s.iloc[-1])
# (datetime.datetime, datetime.timedelta)
# NG, the result must be object dtype contaions Timestamp and Timedelta
idx = pd.DatetimeIndex(['2011-01-01']).append(pd.TimedeltaIndex(['1 days']))
idx
# Index([2011-01-01 00:00:00, 86400000000000], dtype='object')

type(idx[0]), type(idx[-1])
# (pandas.tslib.Timestamp, int)

Expected Output

output of pd.show_versions()

0.18.1