Skip to content

DatetimeIndex behaves inconsistently when start and end have different precisions #9907

Closed
@ptrcarta

Description

@ptrcarta

When creating a DatetimeIndex where start has a greater precision than end for a given frequency the output DatetimeIndex will be shorter than expected

>>>pd.__version__
0.15.2-318-g549b72f


>>>pd.DatetimeIndex(start='2015-04-15 00:00:03', end='2016-04-22 00:00:04', freq='Q')
2015-06-30 00:00:03
2015-09-30 00:00:03
2015-12-31 00:00:03
2016-03-31 00:00:03


>>>pd.DatetimeIndex(start='2015-04-15 00:00:03', end='2016-04-22 00:00', freq='Q')
2015-06-30 00:00:03
2015-09-30 00:00:03
2015-12-31 00:00:03


>>>pd.DatetimeIndex(start='2015-04-15 00:00:03', end='2015-6-22 00:00:04', freq='W')
2015-04-19 00:00:03
2015-04-26 00:00:03
2015-05-03 00:00:03
2015-05-10 00:00:03
2015-05-17 00:00:03
2015-05-24 00:00:03
2015-05-31 00:00:03
2015-06-07 00:00:03
2015-06-14 00:00:03
2015-06-21 00:00:03


>>>pd.DatetimeIndex(start='2015-04-15 00:00:03', end='2015-6-22 00:00', freq='W')
2015-04-19 00:00:03
2015-04-26 00:00:03
2015-05-03 00:00:03
2015-05-10 00:00:03
2015-05-17 00:00:03
2015-05-24 00:00:03
2015-05-31 00:00:03
2015-06-07 00:00:03
2015-06-14 00:00:03

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