Skip to content

DOC fix EX02 algorithms.factorize docstring #51243

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

Merged

Conversation

albuzenet
Copy link
Contributor

Towards #51236.

Fix EX02 docstring errors for :

pandas.factorize
pandas.Index.factorize
pandas.Series.factorize

@MarcoGorelli
Copy link
Member

thanks! can you remove them from the excludes list?

@albuzenet
Copy link
Contributor Author

Done. Thanks for the review @MarcoGorelli

@mroeschke mroeschke added the Docs label Feb 8, 2023
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these are failing

Error: /home/runner/work/pandas/pandas/pandas/core/base.py:1138:EX02:pandas.Index.factorize:Examples do not pass tests:
**********************************************************************
Line 53, in pandas.Index.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1, 2, 0], dtype=int64)
Got:
    array([0, 0, 1, 2, 0])
**********************************************************************
Line 62, in pandas.Index.factorize
Failed example:
    codes
Expected:
    array([1, 1, 0, 2, 1], dtype=int64)
Got:
    array([1, 1, 0, 2, 1])
**********************************************************************
Line 72, in pandas.Index.factorize
Failed example:
    codes
Expected:
    array([ 0, -1,  1,  2,  0], dtype=int64)
Got:
    array([ 0, -1,  1,  2,  0])
**********************************************************************
Line 83, in pandas.Index.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1], dtype=int64)
Got:
    array([0, 0, 1])
**********************************************************************
Line 97, in pandas.Index.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1], dtype=int64)
Got:
    array([0, 0, 1])
**********************************************************************
Line 107, in pandas.Index.factorize
Failed example:
    codes
Expected:
    array([ 0,  1,  0, -1], dtype=int64)
Got:
    array([ 0,  1,  0, -1])
**********************************************************************
Line 113, in pandas.Index.factorize
Failed example:
    codes
Expected:
    array([0, 1, 0, 2], dtype=int64)
Got:
    array([0, 1, 0, 2])

Error: /home/runner/work/pandas/pandas/pandas/core/base.py:1138:EX02:pandas.Series.factorize:Examples do not pass tests:
**********************************************************************
Line 53, in pandas.Series.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1, 2, 0], dtype=int64)
Got:
    array([0, 0, 1, 2, 0])
**********************************************************************
Line 62, in pandas.Series.factorize
Failed example:
    codes
Expected:
    array([1, 1, 0, 2, 1], dtype=int64)
Got:
    array([1, 1, 0, 2, 1])
**********************************************************************
Line 72, in pandas.Series.factorize
Failed example:
    codes
Expected:
    array([ 0, -1,  1,  2,  0], dtype=int64)
Got:
    array([ 0, -1,  1,  2,  0])
**********************************************************************
Line 83, in pandas.Series.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1], dtype=int64)
Got:
    array([0, 0, 1])
**********************************************************************
Line 97, in pandas.Series.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1], dtype=int64)
Got:
    array([0, 0, 1])
**********************************************************************
Line 107, in pandas.Series.factorize
Failed example:
    codes
Expected:
    array([ 0,  1,  0, -1], dtype=int64)
Got:
    array([ 0,  1,  0, -1])
**********************************************************************
Line 113, in pandas.Series.factorize
Failed example:
    codes
Expected:
    array([0, 1, 0, 2], dtype=int64)
Got:
    array([0, 1, 0, 2])

Error: /home/runner/work/pandas/pandas/pandas/core/algorithms.py:612:EX02:pandas.factorize:Examples do not pass tests:
**********************************************************************
Line 58, in pandas.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1, 2, 0], dtype=int64)
Got:
    array([0, 0, 1, 2, 0])
**********************************************************************
Line 67, in pandas.factorize
Failed example:
    codes
Expected:
    array([1, 1, 0, 2, 1], dtype=int64)
Got:
    array([1, 1, 0, 2, 1])
**********************************************************************
Line 77, in pandas.factorize
Failed example:
    codes
Expected:
    array([ 0, -1,  1,  2,  0], dtype=int64)
Got:
    array([ 0, -1,  1,  2,  0])
**********************************************************************
Line 88, in pandas.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1], dtype=int64)
Got:
    array([0, 0, 1])
**********************************************************************
Line 102, in pandas.factorize
Failed example:
    codes
Expected:
    array([0, 0, 1], dtype=int64)
Got:
    array([0, 0, 1])
**********************************************************************
Line 112, in pandas.factorize
Failed example:
    codes
Expected:
    array([ 0,  1,  0, -1], dtype=int64)
Got:
    array([ 0,  1,  0, -1])
**********************************************************************
Line 118, in pandas.factorize
Failed example:
    codes
Expected:
    array([0, 1, 0, 2], dtype=int64)
Got:
    array([0, 1, 0, 2])

Partially validate docstrings (EX02) DONE

@albuzenet
Copy link
Contributor Author

The Docstring validation should be good now.

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup - thanks @albuzenet !

@MarcoGorelli MarcoGorelli added this to the 2.0 milestone Feb 9, 2023
@MarcoGorelli MarcoGorelli merged commit 9e52b49 into pandas-dev:main Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants