-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
DOC: Show constructor arguments for some classes in pd.series.offsets
#61605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
df90c0c
53d68dd
04a6662
6757399
bbdf869
6f5f1ba
3914cda
1d2e420
841ddc7
eab787b
5783fd2
0b07f66
788534a
86e670b
92a8ead
ddbd31a
44f94d1
0cb108e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2737,14 +2737,31 @@ cdef class BYearBegin(YearOffset): | |
_prefix = "BYS" | ||
_day_opt = "business_start" | ||
|
||
# The pair of classes `_YearEnd` and `YearEnd` exist because of | ||
# https://github.com/cython/cython/issues/3873 | ||
|
||
cdef class YearEnd(YearOffset): | ||
cdef class _YearEnd(YearOffset): | ||
_default_month = 12 | ||
_prefix = "YE" | ||
_day_opt = "end" | ||
|
||
cdef readonly: | ||
int _period_dtype_code | ||
|
||
def __init__(self, n=1, normalize=False, month=None): | ||
# Because YearEnd can be the freq for a Period, define its | ||
# _period_dtype_code at construction for performance | ||
YearOffset.__init__(self, n, normalize, month) | ||
self._period_dtype_code = PeriodDtypeCode.A + self.month % 12 | ||
|
||
|
||
class YearEnd(_YearEnd): | ||
""" | ||
DateOffset increments between calendar year end dates. | ||
|
||
YearEnd goes to the next date which is the end of the year. | ||
|
||
Attributes | ||
Parameters | ||
---------- | ||
n : int, default 1 | ||
The number of years represented. | ||
|
@@ -2778,18 +2795,8 @@ cdef class YearEnd(YearOffset): | |
Timestamp('2022-12-31 00:00:00') | ||
""" | ||
|
||
_default_month = 12 | ||
_prefix = "YE" | ||
_day_opt = "end" | ||
|
||
cdef readonly: | ||
int _period_dtype_code | ||
|
||
def __init__(self, n=1, normalize=False, month=None): | ||
# Because YearEnd can be the freq for a Period, define its | ||
# _period_dtype_code at construction for performance | ||
YearOffset.__init__(self, n, normalize, month) | ||
self._period_dtype_code = PeriodDtypeCode.A + self.month % 12 | ||
def __new__(cls, n=1, normalize=False, month=None): | ||
return _YearEnd.__new__(cls, n, normalize, month) | ||
|
||
|
||
cdef class YearBegin(YearOffset): | ||
|
@@ -5188,8 +5195,8 @@ def _warn_about_deprecated_aliases(name: str, is_period: bool) -> str: | |
warnings.warn( | ||
f"\'{name}\' is deprecated and will be removed " | ||
f"in a future version, please use " | ||
f"\'{c_PERIOD_AND_OFFSET_DEPR_FREQSTR.get(name)}\'" | ||
f" instead.", | ||
f"\'{c_PERIOD_AND_OFFSET_DEPR_FREQSTR.get(name)}\' " | ||
f"instead.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Dr-Irv this and the following change have for some time caused pre-commit to fail for me locally. great that this is being fixed here. Thanks. Any idea why CI hasn't picked this up before now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I was surprised as well. |
||
FutureWarning, | ||
stacklevel=find_stack_level(), | ||
) | ||
|
@@ -5202,8 +5209,8 @@ def _warn_about_deprecated_aliases(name: str, is_period: bool) -> str: | |
warnings.warn( | ||
f"\'{name}\' is deprecated and will be removed " | ||
f"in a future version, please use " | ||
f"\'{_name}\'" | ||
f" instead.", | ||
f"\'{_name}\' " | ||
f"instead.", | ||
FutureWarning, | ||
stacklevel=find_stack_level(), | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment that this class exists due to cython/cython#3873
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 0cb108e