Skip to content

Timestamp timezones not preserved for certain indexers #12938

Closed
@azjps

Description

@azjps

Hi, using different indexers on a dataframes with timezone-aware timestamps may return naive timestamps. (A brief search attempt didn't turn up any related issues.)

Code Sample, a copy-pastable example if possible

>>> import pandas as pd
>>> df = pd.Series([pd.tslib.Timestamp('2016-03-30 14:35:25.506088-04:00')]).to_frame()
>>> df = pd.concat([df, df]).reset_index(drop=True)
>>> df[0][0]
Timestamp('2016-03-30 14:35:25.506088-0400', tz='pytz.FixedOffset(-240)')
>>> df.iloc[0,0]
Timestamp('2016-03-30 14:35:25.506088-0400', tz='pytz.FixedOffset(-240)')
>>> df.loc[0,0]
Timestamp('2016-03-30 14:35:25.506088-0400', tz='pytz.FixedOffset(-240)')
>>> df.iat[0,0]
Timestamp('2016-03-30 14:35:25.506088-0400', tz='pytz.FixedOffset(-240)')
>>> df.at[0,0]
Timestamp('2016-03-30 18:35:25.506088')
>>> df.ix[0,0]
Timestamp('2016-03-30 18:35:25.506088')
>>> df.ix[0]
Timestamp('2016-03-30 14:35:25.506088-0400', tz='pytz.FixedOffset(-240)')
>>> df[0].at[0]
Timestamp('2016-03-30 14:35:25.506088-0400', tz='pytz.FixedOffset(-240)')
>>> df[0].ix[0]
Timestamp('2016-03-30 14:35:25.506088-0400', tz='pytz.FixedOffset(-240)')

Expected Output

I'd expect df.at[0,0] and df.ix[0,0] to show the same timezone-aware timestamps as the other indexing methods.

output of pd.show_versions()

>>> import pandas as pd
>>> pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.18.12-el6.ia32e.lime.0
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.0
nose: None
pip: 7.1.0
setuptools: 19.4
Cython: None
numpy: 1.11.0
scipy: None
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDuplicate ReportDuplicate issue or pull requestIndexingRelated to indexing on series/frames, not to indexes themselvesTimezonesTimezone data dtype

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions