Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Dr-Irv
Copy link
Contributor

@Dr-Irv Dr-Irv commented Jun 8, 2025

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 like YearEnd, and BusinessHour because they have explicit __init__() methods. But you won't see it for YearBegin, 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 the super().__init__(), and that makes sphinx then pick up the docs for pandas.tseries.offsets.Day

Also, I had to add the okexcept things to doc/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 a Parameters section to those classes, which is what I did for Day as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant