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: Add examples to Series operators (#24589) #32704

Merged

Conversation

sullivanbt
Copy link
Contributor

Further work on #24589. PR #25524 added examples for many operations but not pandas.Series.eq, pandas.Series.ne, pandas.Series.gt, pandas.Series.ge, pandas.series.le, and pandas.series.lt. This adds examples for those.

pandas.Series.divmod is still missing an example as discussed in #25524.

adds documentation example to:
- `pandas.Series.eq`
- `pandas.Series.ne`
- `pandas.Series.gt`,
- `pandas.Series.ge`
- `pandas.series.le`
- `pandas.series.lt`
@jreback jreback added the Docs label Mar 15, 2020
@datapythonista
Copy link
Member

Thanks for working on this @sullivanbt

What do you think about having in a variable the creation of the Series, which is repeated in every example, and then do something like:

_ne_example_SERIES = _common_examples_SERIES + """
>>> a.ne(b, fill_value=0)
...

This would save a decent amount of repeated code.

@datapythonista datapythonista changed the title DOC: add series examples (#24589) DOC: Add examples to Series operators (#24589) Mar 20, 2020
@sullivanbt
Copy link
Contributor Author

Thanks for the suggestion @datapythonista - I updated the branch with 926a3cf to include that.

@datapythonista
Copy link
Member

Cool. May be it would make sense to rename _common_examples_SERIES to _common_examples_algebra_SERIES to be more explicit.

Did you render one of the pages to html? Would be good to render at least one of each (algebra/comparison), to make sure there are not too many or two few blank lines... If you can post couple of screenshots even better. scripts/validate_docstrings pandas.Series.mul can also be helpful to identify possible errors.

Good job, nice improvement.

reanamed `_common_examples_SERIES` to more descriptive `_common_examples_algebra_SERIES`
@sullivanbt
Copy link
Contributor Author

Completely agree that _common_examples_algebra_SERIES is a more useful name - updated in ca5111b.

I've attached two screenshots - one from the algebra examples one from the comparison. I believe this is how they should be rendering (same as the existing examples) but let me know if not.

Thanks again for your feedback.

image
image

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Really cool @sullivanbt, looks perfect.

I'll let another maintainer merge, so we have couple of eyes on this, but this should be ready. Thanks!

@TomAugspurger TomAugspurger added this to the 1.1 milestone Mar 24, 2020
@TomAugspurger TomAugspurger merged commit 08fce67 into pandas-dev:master Mar 24, 2020
@TomAugspurger
Copy link
Contributor

Thanks @sullivanbt!

@sullivanbt sullivanbt deleted the add_series_examples_to_docs branch March 28, 2020 20:12
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.

4 participants