Skip to content

BUG: Some date-like Offset.apply resets time  #7156

Closed
@sinhrks

Description

@sinhrks

There seems to be inconsistencies regarding time (hours, minutes, etc) handling of Offset.apply. Maybe all these should preserve hours/minutes like DayOffset? Or any other rules?

Followings are results offset(n=1) applied to datetime(2011, 1, 1, 9, 0).

# Offsets which preserves time
(<Day>, datetime.datetime(2011, 1, 2, 9, 0))
(<BusinessDay>, Timestamp('2011-01-03 09:00:00'))
(<CustomBusinessDay>, Timestamp('2011-01-03 09:00:00'))
(<MonthBegin>, Timestamp('2011-02-01 09:00:00'))
(<CustomBusinessMonthBegin>, Timestamp('2011-01-03 09:00:00'))
(<YearBegin: month=1>, Timestamp('2012-01-01 09:00:00'))
(<YearEnd: month=12>, Timestamp('2011-12-31 09:00:00'))
(<BusinessYearEnd: month=12>, Timestamp('2011-12-30 09:00:00'))
(<QuarterBegin: startingMonth=3>, Timestamp('2011-03-01 09:00:00'))
(<BusinessQuarterBegin: startingMonth=3>, Timestamp('2011-03-01 09:00:00'))
(<QuarterEnd: startingMonth=3>, Timestamp('2011-03-31 09:00:00'))
(<BusinessQuarterEnd: startingMonth=3>, Timestamp('2011-03-31 09:00:00'))
(<Week: weekday=None>, Timestamp('2011-01-08 09:00:00'))

# Offsets which don't preserves time
(<BusinessMonthBegin>, Timestamp('2011-01-03 00:00:00'))
(<MonthEnd>, Timestamp('2011-01-31 00:00:00'))
(<BusinessMonthEnd>, Timestamp('2011-01-31 00:00:00'))
(<CustomBusinessMonthEnd>, Timestamp('2011-01-31 00:00:00'))
(<BusinessYearBegin: month=1>, Timestamp('2011-01-03 00:00:00'))
(<LastWeekOfMonth: weekday=5>, Timestamp('2011-01-29 00:00:00'))
(<FY5253Quarter: kwds={'startingMonth': 1, 'weekday': 1, 'variation': 'last'}, qtr_with_extra_week=1>, Timestamp('2011-01-25 00:00:00'))
(<FY5253: kwds={'qtr_with_extra_week': 1}, startingMonth=1, variation='last', weekday=1>, Timestamp('2011-01-25 00:00:00'))
(<LastWeekOfMonth: weekday=5>, Timestamp('2011-01-29 00:00:00'))
(<Easter>, datetime.datetime(2011, 4, 24, 0, 0))

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugFrequencyDateOffsetsTestingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions