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

[FEA] Add .between() to create easier range based mapping #10443

Closed
taureandyernv opened this issue Mar 16, 2022 · 2 comments · Fixed by #11051
Closed

[FEA] Add .between() to create easier range based mapping #10443

taureandyernv opened this issue Mar 16, 2022 · 2 comments · Fixed by #11051
Assignees
Labels
feature request New feature or request good first issue Good for newcomers Python Affects Python cuDF API.

Comments

@taureandyernv
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I was trying to create a set of age ranges for a classifier but couldn't use .between

Describe the solution you'd like

import pandas as pd
import numpy as np

df = pd.DataFrame(data=np.random.randint(1,10,10), columns=['a'])

criteria = [df['a'].between(1, 3), df['a'].between(4, 7), df['a'].between(8, 10)]
values = [1, 2, 3]

df['b'] = np.select(criteria, values, 0)
print(df.head())
@taureandyernv taureandyernv added Needs Triage Need team to review and classify feature request New feature or request labels Mar 16, 2022
@galipremsagar galipremsagar self-assigned this Mar 16, 2022
@shwina shwina added Python Affects Python cuDF API. and removed Needs Triage Need team to review and classify labels Mar 21, 2022
@github-actions
Copy link

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

@beckernick
Copy link
Member

Per the pandas documentation, this function is equivalent to (left <= ser) & (ser <= right) (with exclusivity/inclusivity determined by a parameter)

@beckernick beckernick added the good first issue Good for newcomers label Apr 20, 2022
rapids-bot bot pushed a commit that referenced this issue Jun 6, 2022
Resolves: #10443 

This PR adds `between` API for `Series`. Here is the reference pandas API: https://pandas.pydata.org/docs/reference/api/pandas.Series.between.html

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #11051
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request good first issue Good for newcomers Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants