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: fix pr02 errors in docstrings - plot.bar, plot.barh, plot.line, plot.pie #57266

Merged
merged 8 commits into from
Feb 7, 2024

Conversation

nkasing
Copy link
Contributor

@nkasing nkasing commented Feb 5, 2024

Methods for pandas.Series.plot.bar and pandas.DataFrame.plot.bar have the same underlying usage of PlotAccessor.

validate_docstrings script output

1a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.bar

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.Series.plot.bar" correct. :)

1b. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.bar

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.DataFrame.plot.bar" correct. :)

2a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.barh

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.Series.plot.barh" correct. :)

2b. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.barh

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.DataFrame.plot.barh" correct. :)

3a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.line

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.Series.plot.line" correct. :)

3b. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.line

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.DataFrame.plot.line" correct. :)

4a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.pie

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.Series.plot.pie" correct. :)

4b.  scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.pie

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.DataFrame.plot.pie" correct. :)

@nkasing nkasing marked this pull request as draft February 5, 2024 23:30
@nkasing nkasing marked this pull request as ready for review February 6, 2024 23:10
@mroeschke mroeschke added this to the 3.0 milestone Feb 7, 2024
) -> PlotAccessor:
"""
Plot Series or DataFrame as lines.

This function is useful to plot lines using DataFrame's values
as coordinates.
"""
if color is not None:
Copy link
Member

Choose a reason for hiding this comment

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

Instead can you just specify return self(..., color=color, **kwargs)? (and likewise below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be prettier, but calling self(..., color=None, colormap=foo) raises UserWarnings for simultaneous usage of conflicting args, and the function defaults to use color=None, ignoring the value of colormap.

Similar situation for y in the pieplot, which conflicts with the usage of subplots depending on their respective values.

@mroeschke mroeschke merged commit 65b267a into pandas-dev:main Feb 7, 2024
47 checks passed
@mroeschke
Copy link
Member

Thanks @noah-asing

pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
…plot.pie (pandas-dev#57266)

* bring "color" out of kwargs in bar,barh,line function signatures to match docstring

* bring "y" out of kwargs in pie function signatures to match docstring

* update code_checks for fixed docstrings

* change typehint from np Arraylike to Sequence to avoid dependence on np typing

* Use "IndexLabel" instead of generics

* rebundle args into kwargs before calling self to avoid "cannot use foo arg with bar arg" errors
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