Skip to content

DOC: fix EX02 errors in docstrings #51614

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
merged 2 commits into from
Feb 27, 2023

Conversation

lia2710
Copy link
Contributor

@lia2710 lia2710 commented Feb 24, 2023

Some work towards issue #51236

Makes docstrings pass EX02 error for:

pandas.plotting.radviz
pandas.tseries.frequencies.to_offset

@MarcoGorelli MarcoGorelli self-requested a review February 24, 2023 17:32
@mroeschke mroeschke added the Docs label Feb 24, 2023
@lia2710
Copy link
Contributor Author

lia2710 commented Feb 24, 2023

doctests and doctrings had a conflict on pandas.plotting.radviz example return.
doctests got <AxesSubplot: xlabel='y(t)', ylabel='y(t + 1)'>
doctrings got <AxesSubplot: >

@MarcoGorelli
Copy link
Member

you're right - I'll take a look at why that might be

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.

for the plot one, I think we should just remove the output and skip them, like is done here

.. plot::
:context: close-figs
>>> np.random.seed(1234)
>>> df = pd.DataFrame(np.random.randn(10, 4),
... columns=['Col1', 'Col2', 'Col3', 'Col4'])
>>> boxplot = df.boxplot(column=['Col1', 'Col2', 'Col3']) # doctest: +SKIP

It's not really a meaningful doctest anyway, <AxesSubplot: > could include anything 😄

@lia2710
Copy link
Contributor Author

lia2710 commented Feb 27, 2023

for the plot one, I think we should just remove the output and skip them, like is done here

.. plot::
:context: close-figs
>>> np.random.seed(1234)
>>> df = pd.DataFrame(np.random.randn(10, 4),
... columns=['Col1', 'Col2', 'Col3', 'Col4'])
>>> boxplot = df.boxplot(column=['Col1', 'Col2', 'Col3']) # doctest: +SKIP

It's not really a meaningful doctest anyway, <AxesSubplot: > could include anything 😄

Thank you. Will do.

Just out of curiosity, do you happen to know that why doctests got <AxesSubplot: xlabel='y(t)', ylabel='y(t + 1)'>? I ran the plot on python console and got <AxesSubplot: > too.

@MarcoGorelli
Copy link
Member

I think it's because one of the doctests (hist_plot if I remember right) from _core.py doesn't have the doctest+skip, and so was setting some option

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.

thanks @lia2710 !

@MarcoGorelli MarcoGorelli added this to the 2.1 milestone Feb 27, 2023
@MarcoGorelli MarcoGorelli merged commit ac70f23 into pandas-dev:main Feb 27, 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