question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

swifter apply for resample groups

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jmcarpenter2commented, Nov 20, 2019

@harahu,

I am pleased to inform you that I was finally able to incorporate resample applies into swifter in version 0.296.

To upgrade: pip install swifter==0.296

Syntax: df.swifter.resample(...).apply(...)

Thanks! Jason

1reaction
jmcarpenter2commented, Nov 2, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found