Skip to content

BUG: Concat with tz-aware and timedelta raises AttributeError #12620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sinhrks opened this issue Mar 14, 2016 · 1 comment
Closed

BUG: Concat with tz-aware and timedelta raises AttributeError #12620

sinhrks opened this issue Mar 14, 2016 · 1 comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type Timezones Timezone data dtype
Milestone

Comments

@sinhrks
Copy link
Member

sinhrks commented Mar 14, 2016

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

@sinhrks sinhrks added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type Timezones Timezone data dtype labels Mar 14, 2016
@sinhrks sinhrks added this to the 0.18.1 milestone Mar 14, 2016
@jreback
Copy link
Contributor

jreback commented Mar 14, 2016

hmm, I think these might be caused by the set operations; they require ONLY the specified dtypes, so I don't think this should even hit this paricular ``_compat_concat`, should be handled at a slightly higher level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants