1
- # cython: embedsignature=True
2
-
3
1
import re
4
2
import time
5
3
import warnings
@@ -79,6 +77,7 @@ from pandas._libs.tslibs.np_datetime cimport (
79
77
pandas_datetime_to_datetimestruct,
80
78
pydate_to_dtstruct,
81
79
)
80
+ from pandas.util._decorators import set_module
82
81
83
82
import_pandas_datetime()
84
83
@@ -622,6 +621,7 @@ cdef class BaseOffset:
622
621
@cache_readonly
623
622
def freqstr(self ) -> str:
624
623
"""
624
+
625
625
Return a string representing the frequency.
626
626
627
627
See Also
@@ -648,6 +648,7 @@ cdef class BaseOffset:
648
648
649
649
>>> pd.offsets.Nano(-3).freqstr
650
650
'-3ns'
651
+
651
652
"""
652
653
try:
653
654
code = self .rule_code
@@ -2690,13 +2691,29 @@ cdef class BYearBegin(YearOffset):
2690
2691
_day_opt = " business_start"
2691
2692
2692
2693
2693
- cdef class YearEnd(YearOffset):
2694
+ cdef class _YearEnd(YearOffset):
2695
+ _default_month = 12
2696
+ _prefix = " YE"
2697
+ _day_opt = " end"
2698
+
2699
+ cdef readonly:
2700
+ int _period_dtype_code
2701
+
2702
+ def __init__ (self , n = 1 , normalize = False , month = None ):
2703
+ # Because YearEnd can be the freq for a Period, define its
2704
+ # _period_dtype_code at construction for performance
2705
+ YearOffset.__init__ (self , n, normalize, month)
2706
+ self ._period_dtype_code = PeriodDtypeCode.A + self .month % 12
2707
+
2708
+
2709
+ @ set_module (" pandas.tseries.offsets" )
2710
+ class YearEnd (_YearEnd ):
2694
2711
"""
2695
2712
DateOffset increments between calendar year end dates.
2696
2713
2697
2714
YearEnd goes to the next date which is the end of the year.
2698
2715
2699
- Attributes
2716
+ Parameters
2700
2717
----------
2701
2718
n : int, default 1
2702
2719
The number of years represented.
@@ -2730,18 +2747,9 @@ cdef class YearEnd(YearOffset):
2730
2747
Timestamp('2022-12-31 00:00:00')
2731
2748
"""
2732
2749
2733
- _default_month = 12
2734
- _prefix = " YE"
2735
- _day_opt = " end"
2736
-
2737
- cdef readonly:
2738
- int _period_dtype_code
2739
-
2740
- def __init__ (self , n = 1 , normalize = False , month = None ):
2741
- # Because YearEnd can be the freq for a Period, define its
2742
- # _period_dtype_code at construction for performance
2743
- YearOffset.__init__ (self , n, normalize, month)
2744
- self ._period_dtype_code = PeriodDtypeCode.A + self .month % 12
2750
+ def __new__ (cls , fuck = None , normalize = False , month = None ):
2751
+ # this is a comment
2752
+ return _YearEnd.__new__ (cls , fuck, normalize, month)
2745
2753
2746
2754
2747
2755
cdef class YearBegin(YearOffset):
0 commit comments