BUG: Concat with tz-aware and timedelta raises AttributeError · Issue #12620 · pandas-dev/pandas (original) (raw)

Code Sample, a copy-pastable example if possible

pd.concat([pd.Series([pd.Timestamp('2011-01-01', tz='US/Eastern')]),
           pd.Series([pd.Timedelta('1 day')])])
# AttributeError: 'numpy.ndarray' object has no attribute 'tz_localize'

Expected Output

pd.Series([pd.Timestamp('2011-01-01', tz='US/Eastern'), pd.Timedelta('1 day')])
#0    2011-01-01 00:00:00-05:00
#1              1 days 00:00:00
# dtype: object

output of pd.show_versions()

current master.

It is caused by the below line, we must check typs length must be 1, otherwise the result should be object dtype.

https://github.com/pydata/pandas/blob/master/pandas/tseries/common.py#L278