Date Offset Classes =================== .. currentmodule:: pandasCore DateOffset classes represent regular frequency offsets for date arithmetic. DateOffset ---------- Base class for date offsets. .. code-block:: python import pandasCore as pd # Create offset offset = pd.DateOffset(days=1) # Add to timestamp ts = pd.Timestamp('2023-01-01') ts + offset # 2023-01-02 Parameters ^^^^^^^^^^ .. list-table:: :widths: 15 10 10 65 :header-rows: 1 * - Parameter - Type - Default - Description * - n - int - 1 - Number of periods * - normalize - bool - False - Normalize to midnight * - years - int - 0 - Years to add * - months - int - 0 - Months to add * - weeks - int - 0 - Weeks to add * - days - int - 0 - Days to add * - hours - int - 0 - Hours to add * - minutes - int - 0 - Minutes to add * - seconds - int - 0 - Seconds to add Time Offsets ------------ .. list-table:: :widths: 20 15 65 :header-rows: 1 * - Class - Alias - Description * - Day - D - One day * - Hour - H - One hour * - Minute - T, min - One minute * - Second - S - One second * - Milli - L, ms - One millisecond * - Micro - U, us - One microsecond * - Nano - N, ns - One nanosecond Month Offsets ------------- .. list-table:: :widths: 25 15 60 :header-rows: 1 * - Class - Alias - Description * - MonthEnd - M - End of month * - MonthBegin - MS - Start of month * - BusinessMonthEnd - BM - Business month end * - BusinessMonthBegin - BMS - Business month start Quarter Offsets --------------- .. list-table:: :widths: 25 15 60 :header-rows: 1 * - Class - Alias - Description * - QuarterEnd - Q - End of quarter * - QuarterBegin - QS - Start of quarter * - BQuarterEnd - BQ - Business quarter end * - BQuarterBegin - BQS - Business quarter start Year Offsets ------------ .. list-table:: :widths: 25 15 60 :header-rows: 1 * - Class - Alias - Description * - YearEnd - A, Y - End of year * - YearBegin - AS, YS - Start of year * - BYearEnd - BA, BY - Business year end * - BYearBegin - BAS, BYS - Business year start Business Day Offsets -------------------- .. list-table:: :widths: 25 15 60 :header-rows: 1 * - Class - Alias - Description * - BusinessDay - B - Business day * - BusinessHour - BH - Business hour * - CustomBusinessDay - C - Custom business day Common Methods -------------- All offset classes support: .. list-table:: :widths: 30 70 :header-rows: 1 * - Method - Description * - apply(ts) - Apply offset to timestamp * - rollback(ts) - Roll back to previous period boundary * - rollforward(ts) - Roll forward to next period boundary * - is_on_offset(ts) - Check if timestamp is on offset * - copy() - Create copy of offset