Skip to content

ENH: resample(..., how='range', start=a, stop=b) #3685

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
danielballan opened this issue May 22, 2013 · 6 comments
Closed

ENH: resample(..., how='range', start=a, stop=b) #3685

danielballan opened this issue May 22, 2013 · 6 comments
Labels
Enhancement Groupby Performance Memory or execution speed performance Resample resample method
Milestone

Comments

@danielballan
Copy link
Contributor

Carrying over from SO comments

Is it worth adding kwargs start and stop to enable this succinct usage?

df.resample('D', how='range', start=0, stop=3)
@jreback
Copy link
Contributor

jreback commented May 22, 2013

which could be done faster than, as this can be done in cython

def f(frame):
       l = len(frame)
       if start > l:
          start = l
       if stop > l:
           stop = l
       return frame.iloc[start:stop,:]
df.resample('D',how=f)

@jreback
Copy link
Contributor

jreback commented May 22, 2013

@danielballan fyi..i think the perf difference of using groupby(lambda x: x.date()) and resample is really inconsequential to calling the user function

@danielballan
Copy link
Contributor Author

Where would I put the Cython? lib.pyx?

@jreback
Copy link
Contributor

jreback commented May 22, 2013

look in pandas/algos.pyx, you would create something like group_nth_object and in pandas/src/generated.pyx, where group_nth_float64 and other dtypes are handled (the generated are code generateors)

@jreback
Copy link
Contributor

jreback commented May 22, 2013

sorry I meant pandas/src/generate_code.py, which actually creates the generated.py (but to test just create the cython directly)

@jreback
Copy link
Contributor

jreback commented Jan 26, 2015

this is xref in #7387 already

@jreback jreback closed this as completed Jan 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Groupby Performance Memory or execution speed performance Resample resample method
Projects
None yet
Development

No branches or pull requests

2 participants