Skip to content

API for selecting ranged groups #6675

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

Open
cpcloud opened this issue Mar 20, 2014 · 5 comments
Open

API for selecting ranged groups #6675

cpcloud opened this issue Mar 20, 2014 · 5 comments

Comments

@cpcloud
Copy link
Member

cpcloud commented Mar 20, 2014

I often find myself writing code that looks like this:

start_group = df[df.str_col == 'start'].index.values + 1
end_group = df[df.str_col == 'end'].index.values - 1
for s, e in zip(start_group, end_group):
    some_function(df[s:e])

to get frame subsets between repeated start and end indicators from a particular column.

Possible API:

df.grange(marker_col='str_col', start='start', end='end')

which would return an iterator over the the subsets.

I'm not sure if this is general enough to include in library code. I'll happily close the issue if it's not. There also might be a way to do this already.

@jreback
Copy link
Contributor

jreback commented Mar 22, 2014

kind of like #3685

and like split #4059, make add this example there?

@dsm054
Copy link
Contributor

dsm054 commented Mar 23, 2014

Requests for improved split/partition tools now make up, what, a half-dozen or so enhancement requests? (Including one of mine. :^)

@jreback
Copy link
Contributor

jreback commented May 16, 2014

@cpcloud can you find all of the split/partition issues and put them in one master issue (maybe checkboxes?), possibly creating another tag (maybe split?) instead of using groupby tag?

@jreback jreback added this to the 0.15.0 milestone May 16, 2014
@cpcloud
Copy link
Member Author

cpcloud commented May 16, 2014

sure thing

@jreback
Copy link
Contributor

jreback commented Jun 3, 2014

@cpcloud can you consolidate these issues when you have a chance (putting in a single master isse) with checkboxes

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants