Skip to content
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

DOC: Fixed PR01 for pandas.Series.cat #58750

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

03darius
Copy link

Ref #58504

Fixes PR01 for

-i "pandas.Series.cat.add_categories PR01,PR02" \
-i "pandas.Series.cat.as_ordered PR01" \
-i "pandas.Series.cat.as_unordered PR01" \
-i "pandas.Series.cat.remove_categories PR01,PR02" \
-i "pandas.Series.cat.remove_unused_categories PR01" \
-i "pandas.Series.cat.rename_categories PR01,PR02" \
-i "pandas.Series.cat.reorder_categories PR01,PR02" \
-i "pandas.Series.cat.set_categories PR01,PR02" \

I couldn't figure out how to fix PR02. If I'm getting it right, numpydoc detects PR02 errors if there are parameters described in the docstring that are not in the method signature. I dug into how the docstring validation works and found that it uses the signature of f defined in pandas/core/accessor.py instead of the actual signature of the methods defined in pandas/core/arrays/categorical.py

For reference, here's that delegator:

def _create_delegator_method(name: str):
    def f(self, *args, **kwargs):
        return self._delegate_method(name, *args, **kwargs)

    f.__name__ = name
    f.__doc__ = getattr(delegate, accessor_mapping(name)).__doc__

    return f

So PR02 is always detected if the method has any parameters. How should this be handled?

…rdered, remove_categories, remove_unused_categories, rename_categories, reorder_categories, set_categories
@03darius 03darius requested a review from mroeschke as a code owner May 17, 2024 13:06
@Aloqeely
Copy link
Member

You're right, this seems to be a problem on pandas' end. If you can investigate and open a separate PR to fix the problem that would be really appreciated!

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.

None yet

2 participants