Description
In [2]: tz = pd.DatetimeIndex(['2013-01-01 06:00'], tz='US/Pacific').tz
In [3]: tz
Out[3]: <DstTzInfo 'US/Pacific' LMT-1 day, 16:07:00 STD>
In [4]: pd.Timestamp('2013-01-01 06:00', tz=tz).tz
Out[4]: <DstTzInfo 'US/Pacific' PST-1 day, 16:00:00 STD>
Problem description
Localization of the timezone should be maintained when creating a Timestamp. I also believe this is the root issue of #13238 since resample()
calls groupby()
which (I think) reconstructs the index with Timestamps.
In [10]: s = pd.Series(index=pd.DatetimeIndex(['2013-01-01 06:00', '2013-01-01 07:00', '2013-01-02 06:00'],
tz='America/Los_Angeles'),
data=[1, 2, 3])
In [13]: s.index.tz
Out[13]: <DstTzInfo 'America/Los_Angeles' LMT-1 day, 16:07:00 STD>
In [14]: s.resample('D').max().index.tz
Out[14]: <DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>
Expected Output
<DstTzInfo 'US/Pacific' LMT-1 day, 16:07:00 STD>
Output of pd.show_versions()
INSTALLED VERSIONS
commit: 92239f5
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-45-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.19.0+644.g92239f5.dirty
pytest: 3.0.6
pip: 8.1.2
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.2
scipy: None
xarray: None
IPython: 5.1.0
sphinx: 1.4.8
patsy: None
dateutil: 2.5.3
pytz: 2016.7
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 1.5.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
s3fs: None
pandas_gbq: None
pandas_datareader: None