swifter apply for resample groups
See original GitHub issueI’ve used swifter to speed up apply calls on DataFrames, but this isn’t the only context apply is used in pandas. Would it be simple to implement for resample objects also?
See: pandas.DataFrame.resample
Can we go from:
series.resample('3T').apply(custom_resampler)
to:
series.resample('3T').swifter.apply(custom_resampler)
?
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Parallelize apply after pandas groupby - Stack Overflow
You can use either multiprocessing or joblib to achieve parallelization. However, if the number of groups is large and each group DataFrame is ......
Read more >pandas.core.resample.Resampler.apply
Transforms the Series on each group based on the given function. DataFrame.aggregate. Aggregate using one or more operations over the specified axis. Notes....
Read more >How to use the swifter.progress_bar function in swifter | Snyk
To help you get started, we've selected a few swifter.progress_bar examples, ... desc=None).apply( convert_date) for group in ['special_attributes', ...
Read more >Swifter — automatically efficient pandas apply operations
An introduction to swiftapply, a generalized method for easily and efficiently applying any function to a pandas dataframe or series.
Read more >Grouping by a Timestamp and another column - Second Edition
In this recipe, we will show two very similar but different approaches to group by Timestamps and another column. How to do it…...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@harahu,
I am pleased to inform you that I was finally able to incorporate
resample
applies intoswifter
in version0.296
.To upgrade:
pip install swifter==0.296
Syntax:
df.swifter.resample(...).apply(...)
Thanks! Jason
Hi @harahu,
Thanks for proposing this feature. At the request of another user, I just added support for Rolling objects. I was able to do so because the underlying parallelization library,
dask
, has support for rolling object parallelized applies.Unfortunately, while they do have support for creating Resampler objects in dask, those objects do not currently have an apply function that I can leverage.
If/when the dask contributors add an apply function for resampler objects, then I will happily add that functionality to the package.