Skip to content

DOC: update the Series.between docstring #20443

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 3 commits into from
Mar 28, 2018

Conversation

mrw34
Copy link
Contributor

@mrw34 mrw34 commented Mar 21, 2018

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

  • PR title is "DOC: update the docstring"
  • The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • The html version looks good: python doc/make.py --single <your-function-or-method>
  • It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

################################################################################
###################### Docstring (pandas.Series.between)  ######################
################################################################################

Return boolean Series equivalent to left <= series <= right.

This function returns a boolean vector containing `True` wherever the
corresponding Series element is between the boundary values `left` and
`right`. NA values are treated as `False`.

Parameters
----------
left : scalar
    Left boundary.
right : scalar
    Right boundary.
inclusive : bool, default True
    Include boundaries.

Returns
-------
is_between : Series

Examples
--------

>>> s = pd.Series([2, 0, 4, 8, np.nan])

Boundary values are included by default:

>>> s.between(1, 4)
0     True
1    False
2     True
3    False
4    False
dtype: bool

With `inclusive` set to `False` boundary values are excluded:

>>> s.between(1, 4, inclusive=False)
0     True
1    False
2    False
3    False
4    False
dtype: bool

`left` and `right` can be any scalar value:

>>> s = pd.Series(['Alice', 'Bob', 'Carol', 'Eve'])
>>> s.between('Anna', 'Daniel')
0    False
1     True
2     True
3    False
dtype: bool

See Also
--------
DataFrame.query : Query the columns of a frame with a boolean
    expression.

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

Docstring for "pandas.Series.between" correct. :)

@pep8speaks
Copy link

pep8speaks commented Mar 21, 2018

Hello @mrw34! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on March 24, 2018 at 07:57 Hours UTC

@mrw34 mrw34 force-pushed the series-between-docstring branch from f09c3c9 to 673a28e Compare March 21, 2018 22:25
@codecov
Copy link

codecov bot commented Mar 22, 2018

Codecov Report

Merging #20443 into master will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20443      +/-   ##
==========================================
+ Coverage   91.82%   91.85%   +0.02%     
==========================================
  Files         152      152              
  Lines       49248    49231      -17     
==========================================
- Hits        45222    45220       -2     
+ Misses       4026     4011      -15
Flag Coverage Δ
#multiple 90.23% <ø> (+0.02%) ⬆️
#single 41.83% <ø> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/core/series.py 93.84% <ø> (ø) ⬆️
pandas/core/arrays/base.py 83.33% <0%> (-0.82%) ⬇️
pandas/core/algorithms.py 94.29% <0%> (-0.07%) ⬇️
pandas/core/base.py 96.78% <0%> (-0.01%) ⬇️
pandas/core/indexes/base.py 96.68% <0%> (-0.01%) ⬇️
pandas/core/frame.py 97.18% <0%> (-0.01%) ⬇️
pandas/core/generic.py 95.85% <0%> (ø) ⬆️
pandas/core/indexes/period.py 92.61% <0%> (ø) ⬆️
pandas/core/reshape/reshape.py 100% <0%> (ø) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cdfce2b...b3c44da. Read the comment docs.

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.

Looks great, added couple of comments.

See Also
--------
DataFrame.query : Query the columns of a frame with a boolean
expression.
Copy link
Member

Choose a reason for hiding this comment

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

Personally I don't find DataFrame.query so related. But if we list it, I'd explain it a bit better than it can be used to perform comparisons, so users understand why it's related.

The ones that I do find related are Series.gt and Series.lt.

The See Also section should be placed before the examples, not after.


Examples
--------

Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need this blank line.

Right boundary
Right boundary.
inclusive : bool, default True
Include boundaries.

Returns
-------
is_between : Series
Copy link
Member

Choose a reason for hiding this comment

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

You can leave just Series, or Series of bool to be more explicit. The returned name is_between is not needed.

@mrw34
Copy link
Contributor Author

mrw34 commented Mar 24, 2018

@datapythonista Thanks Marc! Hopefully looking better now...

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.

lgtm

[ci skip]
@TomAugspurger TomAugspurger merged commit 36ac1dd into pandas-dev:master Mar 28, 2018
@TomAugspurger
Copy link
Contributor

Thanks @mrw34

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 28, 2018
javadnoorb pushed a commit to javadnoorb/pandas that referenced this pull request Mar 29, 2018
dworvos pushed a commit to dworvos/pandas that referenced this pull request Apr 2, 2018
kornilova203 pushed a commit to kornilova203/pandas that referenced this pull request Apr 23, 2018
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.

4 participants