DOC: Show constructor arguments for some classes in pd.series.offsets
#61605
+18
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This contributes to #52431
In that issue, the goal is to show the arguments for the constructors for the various offsets, which are all in
pyx
files.The problem is that
sphinx
doesn't pick up the arguments for__init__()
in those files. By adding the# cython: embedsignature=True
at the top of the file, then it will pick it up for any class we document that has an explicit__init__()
method. So, if you preview the docs from this MR, you will see it for classes likeYearEnd
, andBusinessHour
because they have explicit__init__()
methods. But you won't see it forYearBegin
, for example, because it has no explicit__init__()
method.So to fix that, I illustrate how to fix it for
Day
, where I introduce an__init__()
method that just calls thesuper().__init__()
, and that makes sphinx then pick up the docs forpandas.tseries.offsets.Day
Also, I had to add the
okexcept
things todoc/source/user_guide/enhancingperf.rst
because otherwise the docs would not build on Windows.If this PR is accepted, then we can get the community to do the work of adding the various
__init__()
methods to the other documented offset classes and they can also add aParameters
section to those classes, which is what I did forDay
as well.