Skip to content

BUG: Timestamp.tz_localize resets nanosecond #7534

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

Merged
merged 1 commit into from
Jun 21, 2014

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jun 21, 2014

Timestamp.tz_localize resets nanosecond.

t = pd.Timestamp('2011-01-01') + pd.offsets.Nano(1)
t.tz_localize('US/Eastern')
# Warning: discarding nonzero nanoseconds
#2011-01-01 00:00:00-05:00

Even though DatetimeIndex.tz_convert can preserve it.

idx = pd.date_range('3/11/2012 04:00', periods=10, freq='N')
idx.tz_localize('US/Eastern')
# <class 'pandas.tseries.index.DatetimeIndex'>
# [2012-03-11 04:00:00-04:00, ..., 2012-03-11 04:00:00.000000009-04:00]
# Length: 10, Freq: N, Timezone: US/Eastern

@sinhrks
Copy link
Member Author

sinhrks commented Jun 21, 2014

Ah, the subject and release note are incorrect. Problem is tz_localize, not tz_convert. As I'm out, will fix later.

@jreback jreback added this to the 0.14.1 milestone Jun 21, 2014
jreback added a commit that referenced this pull request Jun 21, 2014
BUG: Timestamp.tz_convert resets nanosecond
@jreback jreback merged commit d60c46a into pandas-dev:master Jun 21, 2014
@jreback
Copy link
Contributor

jreback commented Jun 21, 2014

thanks!

@sinhrks sinhrks deleted the nanotz branch June 21, 2014 14:41
@sinhrks sinhrks changed the title BUG: Timestamp.tz_convert resets nanosecond BUG: Timestamp.tz_localize resets nanosecond Jun 21, 2014
@sinhrks
Copy link
Member Author

sinhrks commented Jun 21, 2014

Sorry, corrected subject and sent another PR to fix release note.

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

Successfully merging this pull request may close these issues.

2 participants