GroupBy like API for resample
See original GitHub issueSince we wrote resample
in xarray, pandas updated resample to have a groupyby-like API (e.g., df.resample('24H').mean()
vs. the old df.resample('24H')
that uses the mean by default).
It would be nice to redo the xarray resample API to match, e.g., ds.resample(time='24H').mean()
vs ds.resample('time', '24H')
. This would solve a few use cases, including grouped-resample arithmetic, iterating over groups and (mostly) take care of the need for pd.TimeGrouper
support (https://github.com/pydata/xarray/issues/364). If we use **kwargs
for matching dimension names, this could be done with a minimally painful deprecation cycle.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
pandas.core.groupby.DataFrameGroupBy.resample
Provide resampling when using a TimeGrouper. Given a grouper, the function resamples it according to a string “string” -> “frequency”. See the frequency ......
Read more >Pandas: resample timeseries with groupby
I would like resample the data to aggregate it hourly by count while grouping by location to produce a data frame that looks...
Read more >Grouping and Sampling Time Series Data | by Shelvi Garg
We will solve these using only 2 Pandas APIs i.e. resample() and GroupBy(). Resample():. The resample() function is used to resample time-series data....
Read more >How to group data by time intervals in Python Pandas?
This is similar to resample(), so whatever we discussed above applies here as well. We added store_type to the groupby so that for...
Read more >cudf.DataFrame.resample — cudf 22.12.00 documentation
For a DataFrame, column to use instead of the index for resampling. Column must be a datetime-like. level: str or int, optional.
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
@MaximilianR Oh, the interface is easy enough to do, even maintaining backwards-compatibility (already have that working). I was considering going the route done with GroupBy and the classes that compose it, like DatasetGroupBy… basically, we just record the wanted resampling dimension and inject the grouping/resampling operations we want. Also adds the ability to specialize methods like
.first()
and.last()
, which is done under the current implementation.But… if there’s a simpler way, that might be preferable!
I think this could be done with minimal GroupBy subclasses to supply the default dimension argument for aggregation functions. All the machinery on groupby should already be there. On Wed, Feb 15, 2017 at 10:59 AM Daniel Rothenberg notifications@github.com wrote: