Skip to content

Out-by-one error when slicing a TimeSeries with date-strings #3905

Closed
@dhirschfeld

Description

@dhirschfeld

...when the hour is not zero.

Example below:

In [7]: series = pd.TimeSeries(numpy.arange(5), pd.date_range('2014-01-01 09:00', periods=5, freq='D'))
   ...: series
   ...: 
Out[7]: 
2014-01-01 09:00:00    0
2014-01-02 09:00:00    1
2014-01-03 09:00:00    2
2014-01-04 09:00:00    3
2014-01-05 09:00:00    4
Freq: D, dtype: int32

In [8]: series[pd.datetime(2014, 1, 2):pd.datetime(2014, 1, 4)]
Out[8]: 
2014-01-02 09:00:00    1
2014-01-03 09:00:00    2
Freq: D, dtype: int32

In [9]: series['02-Jan-2014':'04-Jan-2014']
Out[9]: 
2014-01-02 09:00:00    1
2014-01-03 09:00:00    2
2014-01-04 09:00:00    3   <------------------------- ???
Freq: D, dtype: int32

In [10]: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions