@@ -600,8 +600,10 @@ cdef class BaseOffset:
600
600
601
601
See Also
602
602
--------
603
- tseries.offsets.Hour.rule_code : Returns a string representing the base frequency of 'h'.
604
- tseries.offsets.Day.rule_code : Returns a string representing the base frequency of 'D'.
603
+ tseries.offsets.Hour.rule_code :
604
+ Returns a string representing the base frequency of 'h'.
605
+ tseries.offsets.Day.rule_code :
606
+ Returns a string representing the base frequency of 'D'.
605
607
606
608
Examples
607
609
--------
@@ -610,7 +612,7 @@ cdef class BaseOffset:
610
612
611
613
>>> pd.offsets.Week(5).rule_code
612
614
'W'
613
- """ # noqa
615
+ """
614
616
return self._prefix
615
617
616
618
@cache_readonly
@@ -620,10 +622,14 @@ cdef class BaseOffset:
620
622
621
623
See Also
622
624
--------
623
- tseries.offsets.BusinessDay.freqstr : Return a string representing an offset frequency in Business Days.
624
- tseries.offsets.BusinessHour.freqstr : Return a string representing an offset frequency in Business Hours.
625
- tseries.offsets.Week.freqstr : Return a string representing an offset frequency in Weeks.
626
- tseries.offsets.Hour.freqstr : Return a string representing an offset frequency in Hours.
625
+ tseries.offsets.BusinessDay.freqstr :
626
+ Return a string representing an offset frequency in Business Days.
627
+ tseries.offsets.BusinessHour.freqstr :
628
+ Return a string representing an offset frequency in Business Hours.
629
+ tseries.offsets.Week.freqstr :
630
+ Return a string representing an offset frequency in Weeks.
631
+ tseries.offsets.Hour.freqstr :
632
+ Return a string representing an offset frequency in Hours.
627
633
628
634
Examples
629
635
--------
@@ -638,7 +644,7 @@ cdef class BaseOffset:
638
644
639
645
>>> pd.offsets.Nano(-3).freqstr
640
646
'-3ns'
641
- """ # noqa
647
+ """
642
648
try:
643
649
code = self .rule_code
644
650
except NotImplementedError:
@@ -812,16 +818,20 @@ cdef class BaseOffset:
812
818
813
819
See Also
814
820
--------
815
- tseries.offsets.WeekOfMonth.nanos : Raises a ValueError because the frequency is non-fixed.
816
- tseries.offsets.YearBegin.nanos : Raises a ValueError because the frequency is non-fixed.
817
- tseries.offsets.Hour.nanos : Returns an integer of the total number of nanoseconds.
818
- tseries.offsets.Day.nanos : Returns an integer of the total number of nanoseconds.
821
+ tseries.offsets.WeekOfMonth.nanos :
822
+ Raises a ValueError because the frequency is non-fixed.
823
+ tseries.offsets.YearBegin.nanos :
824
+ Raises a ValueError because the frequency is non-fixed.
825
+ tseries.offsets.Hour.nanos :
826
+ Returns an integer of the total number of nanoseconds.
827
+ tseries.offsets.Day.nanos :
828
+ Returns an integer of the total number of nanoseconds.
819
829
820
830
Examples
821
831
--------
822
832
>>> pd.offsets.Week(n=1).nanos
823
833
ValueError: Week: weekday=None is a non-fixed frequency
824
- """ # noqa
834
+ """
825
835
raise ValueError (f" {self} is a non-fixed frequency" )
826
836
827
837
# ------------------------------------------------------------------
@@ -1033,16 +1043,20 @@ cdef class Tick(SingleConstructorOffset):
1033
1043
1034
1044
See Also
1035
1045
--------
1036
- tseries.offsets.Hour.nanos : Returns an integer of the total number of nanoseconds.
1037
- tseries.offsets.Day.nanos : Returns an integer of the total number of nanoseconds.
1038
- tseries.offsets.WeekOfMonth.nanos : Raises a ValueError because the frequency is non-fixed.
1039
- tseries.offsets.YearBegin.nanos : Raises a ValueError because the frequency is non-fixed.
1046
+ tseries.offsets.Hour.nanos :
1047
+ Returns an integer of the total number of nanoseconds.
1048
+ tseries.offsets.Day.nanos :
1049
+ Returns an integer of the total number of nanoseconds.
1050
+ tseries.offsets.WeekOfMonth.nanos :
1051
+ Raises a ValueError because the frequency is non-fixed.
1052
+ tseries.offsets.YearBegin.nanos :
1053
+ Raises a ValueError because the frequency is non-fixed.
1040
1054
1041
1055
Examples
1042
1056
--------
1043
1057
>>> pd.offsets.Hour(5).nanos
1044
1058
18000000000000
1045
- """ # noqa
1059
+ """
1046
1060
return self.n * self._nanos_inc
1047
1061
1048
1062
def is_on_offset(self , dt: datetime ) -> bool:
@@ -2476,8 +2490,10 @@ cdef class WeekOfMonthMixin(SingleConstructorOffset):
2476
2490
2477
2491
See Also
2478
2492
--------
2479
- tseries.offsets.Hour.rule_code : Returns a string representing the base frequency of 'h'.
2480
- tseries.offsets.Day.rule_code : Returns a string representing the base frequency of 'D'.
2493
+ tseries.offsets.Hour.rule_code :
2494
+ Returns a string representing the base frequency of 'h'.
2495
+ tseries.offsets.Day.rule_code :
2496
+ Returns a string representing the base frequency of 'D'.
2481
2497
2482
2498
Examples
2483
2499
--------
@@ -2486,7 +2502,7 @@ cdef class WeekOfMonthMixin(SingleConstructorOffset):
2486
2502
2487
2503
>>> pd.offsets.WeekOfMonth(n = 1 , week = 0 , weekday = 0 ).rule_code
2488
2504
'WOM-1MON'
2489
- """ # noqa
2505
+ """
2490
2506
weekday = int_to_weekday.get(self .weekday, " " )
2491
2507
if self.week == -1:
2492
2508
# LastWeekOfMonth
@@ -2538,8 +2554,10 @@ cdef class YearOffset(SingleConstructorOffset):
2538
2554
2539
2555
See Also
2540
2556
--------
2541
- tseries.offsets.Hour.rule_code : Returns a string representing the base frequency of 'h'.
2542
- tseries.offsets.Day.rule_code : Returns a string representing the base frequency of 'D'.
2557
+ tseries.offsets.Hour.rule_code :
2558
+ Returns a string representing the base frequency of 'h'.
2559
+ tseries.offsets.Day.rule_code :
2560
+ Returns a string representing the base frequency of 'D'.
2543
2561
2544
2562
Examples
2545
2563
--------
@@ -2548,7 +2566,7 @@ cdef class YearOffset(SingleConstructorOffset):
2548
2566
2549
2567
>>> pd.tseries.offsets.YearEnd(n = 1 , month = 6 ).rule_code
2550
2568
'YE-JUN'
2551
- """ # noqa
2569
+ """
2552
2570
month = MONTH_ALIASES[self .month]
2553
2571
return f"{self._prefix}-{month}"
2554
2572
@@ -3540,8 +3558,10 @@ cdef class Week(SingleConstructorOffset):
3540
3558
3541
3559
See Also
3542
3560
--------
3543
- tseries.offsets.Hour.name : Returns a string representing the base frequency of 'h'.
3544
- tseries.offsets.Day.name : Returns a string representing the base frequency of 'D'.
3561
+ tseries.offsets.Hour.name :
3562
+ Returns a string representing the base frequency of 'h'.
3563
+ tseries.offsets.Day.name :
3564
+ Returns a string representing the base frequency of 'D'.
3545
3565
3546
3566
Examples
3547
3567
--------
@@ -3550,7 +3570,7 @@ cdef class Week(SingleConstructorOffset):
3550
3570
3551
3571
>>> pd.offsets.Week(5).rule_code
3552
3572
'W'
3553
- """ # noqa
3573
+ """
3554
3574
suffix = " "
3555
3575
if self.weekday is not None:
3556
3576
weekday = int_to_weekday[self .weekday]
0 commit comments