Skip to content

DOC: Series.between() can take arguments that are Series, not just scalars #28435

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

Closed
Dr-Irv opened this issue Sep 13, 2019 · 4 comments · Fixed by #28717
Closed

DOC: Series.between() can take arguments that are Series, not just scalars #28435

Dr-Irv opened this issue Sep 13, 2019 · 4 comments · Fixed by #28717
Labels
Milestone

Comments

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Sep 13, 2019

Code Sample, a copy-pastable example if possible

In [1]: import pandas as pd

In [2]: s = pd.Series([4,5,6])
   ...: s1 = pd.Series([3,6, 5])
   ...: s2 = pd.Series([8,8,8])
   ...: s.between(s1, s2)
Out[2]:
0     True
1    False
2     True
dtype: bool

Problem description

The docs for Series.between() at https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.between.html indicate that the left and right arguments are scalars, but it is possible (as shown above) to use a Series as either argument.

The docs should be updated to reflect this, including the examples.

Expected Output

N/A

Output of pd.show_versions()

C:\Anaconda3\lib\site-packages\xarray\core\merge.py:17: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version
PANDAS_TYPES = (pd.Series, pd.DataFrame, pd.Panel)

INSTALLED VERSIONS

commit : None
python : 3.7.3.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None

pandas : 0.25.1
numpy : 1.16.4
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.2
setuptools : 41.0.1
Cython : 0.29.12
pytest : 5.0.1
hypothesis : None
sphinx : 2.1.2
blosc : None
feather : None
xlsxwriter : 1.1.8
lxml.etree : 4.4.1
html5lib : 1.0.1
pymysql : 0.9.3
psycopg2 : 2.7.6.1 (dt dec pq3 ext lo64)
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : 4.8.0
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.1.1
numexpr : 2.6.9
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : 1.3.7
tables : 3.5.2
xarray : 0.12.1
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.1.8

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Sep 13, 2019

Does this align by series before doing the operation?

@TomAugspurger TomAugspurger added this to the Contributions Welcome milestone Sep 13, 2019
@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Sep 13, 2019

No, if the indices don't perfectly align (or you don't use a scalar), you get

ValueError: Can only compare identically-labeled Series objects

@TomAugspurger
Copy link
Contributor

Ok, so the arguments can be scalar or any list-like with the same number of elements as self?

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Sep 19, 2019

Yes. Basically for s.between(a,b), if a < s and s < b are valid, then s.between(a,b) is valid

@jreback jreback modified the milestones: Contributions Welcome, 1.0 Oct 1, 2019
jreback pushed a commit that referenced this issue Oct 1, 2019
…alars (#28717)

modified the docs of Series.between() to reflect that it can take any
list like object

closes #28435
proost pushed a commit to proost/pandas that referenced this issue Dec 19, 2019
…alars (pandas-dev#28717)

modified the docs of Series.between() to reflect that it can take any
list like object

closes pandas-dev#28435
proost pushed a commit to proost/pandas that referenced this issue Dec 19, 2019
…alars (pandas-dev#28717)

modified the docs of Series.between() to reflect that it can take any
list like object

closes pandas-dev#28435
bongolegend pushed a commit to bongolegend/pandas that referenced this issue Jan 1, 2020
…alars (pandas-dev#28717)

modified the docs of Series.between() to reflect that it can take any
list like object

closes pandas-dev#28435
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 a pull request may close this issue.

3 participants