Skip to content

Series append function drops timezone information #2260

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
dirkdevriendt opened this issue Nov 15, 2012 · 0 comments
Closed

Series append function drops timezone information #2260

dirkdevriendt opened this issue Nov 15, 2012 · 0 comments
Labels
Bug Datetime Datetime data dtype
Milestone

Comments

@dirkdevriendt
Copy link

Except when one of the two series is empty; in that case a tz-aware Series is returned

Code to reproduce:

import numpy as np
import pandas as pd
rng1 = pd.date_range('1/1/2011 01:00', periods=1, freq='H')
rng2 = pd.date_range('1/1/2011 02:00', periods=1, freq='H')
ts1 = pd.Series(np.random.randn(len(rng1)), index=rng1).tz_localize('UTC')
ts2 = pd.Series(np.random.randn(len(rng2)), index=rng2).tz_localize('UTC')
ts_result = ts1.append(ts2)

Result in IPython:

In [1]: import numpy as np

In [2]: import pandas as pd

In [3]: rng1 = pd.date_range('1/1/2011 01:00', periods=1, freq='H')

In [4]: rng2 = pd.date_range('1/1/2011 02:00', periods=1, freq='H')

In [5]: ts1 = pd.Series(np.random.randn(len(rng1)), index=rng1).tz_localize('UTC')

In [6]: ts1
Out[6]:
2011-01-01 01:00:00+00:00 1.870471
Freq: H

In [7]: ts2 = pd.Series(np.random.randn(len(rng2)), index=rng2).tz_localize('UTC')

In [8]: ts2
Out[8]:
2011-01-01 02:00:00+00:00 1.266536
Freq: H

In [9]: ts_result = ts1.append(ts2)

In [10]: ts_result
Out[10]:
2011-01-01 01:00:00 1.870471
2011-01-01 02:00:00 1.266536

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

No branches or pull requests

2 participants