Skip to content

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jun 5, 2015

DatetimeIndex preserve freq after slicing.

di = pd.date_range('2001', '2005', freq='D')
di[1:5:2]
# DatetimeIndex(['2001-01-02', '2001-01-04'], dtype='datetime64[ns]', freq='2D', tz=None)

But TimedeltaIndex doesn't.

tdi = pd.timedelta_range('1day', '5day', freq='D')
tdi[1:5:2]
# TimedeltaIndex(['2 days', '4 days'], dtype='timedelta64[ns]', freq=None)

@sinhrks sinhrks added Bug Timedelta Timedelta data type Frequency DateOffsets labels Jun 6, 2015
@sinhrks sinhrks added this to the 0.16.2 milestone Jun 6, 2015
jreback added a commit that referenced this pull request Jun 7, 2015
BUG: TimedeltaIndex slicing may reset freq
@jreback jreback merged commit c5d15a0 into pandas-dev:master Jun 7, 2015
@jreback
Copy link
Contributor

jreback commented Jun 7, 2015

thanks you sir!

@sinhrks sinhrks deleted the tdi_freq branch June 8, 2015 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants