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.

resample doesn't support `.aggregate`

See original GitHub issue
In [308]: s # pandas series
Out[308]: 
2000-01-01 00:00:00    0
2000-01-01 00:01:00    1
2000-01-01 00:02:00    2
2000-01-01 00:03:00    3
2000-01-01 00:04:00    4
2000-01-01 00:05:00    5
2000-01-01 00:06:00    6
2000-01-01 00:07:00    7
2000-01-01 00:08:00    8
Freq: T, dtype: int64

In [309]: s.resample('2min').aggregate('asfreq')
Out[309]: 
2000-01-01 00:00:00    0
2000-01-01 00:02:00    2
2000-01-01 00:04:00    4
2000-01-01 00:06:00    6
2000-01-01 00:08:00    8
Freq: 2T, dtype: int64

In [310]: dd.from_pandas(s, 2).resample('2min').aggregate('asfreq')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-310-3b266d1c3122> in <module>()
----> 1 dd.from_pandas(s, 2).resample('2min').aggregate('asfreq')

AttributeError: 'Resampler' object has no attribute 'aggregate'

@jcrist I think you’re the resampling guru?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jcristcommented, Jun 15, 2016

Sure, aggregate could be added. Will probably get to it later today. If all you’re looking for is .agg('asfreq'), I’m pretty sure that’s equivalent to .first() (which is currently implemented).

0reactions
jsignellcommented, Dec 9, 2020

I am closing this since it is about agg on resample which is on latest dask.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pandas named aggregation not working with resample agg
It's a bug. Solved in pandas >=1.4.0 . Try workaround for <1.4.0: func = None. .agg(func = None, open=pd.NamedAgg("trade_price", "first") .
Read more >
pandas.core.resample.Resampler.aggregate
Functions that mutate the passed object can produce unexpected behavior or errors and are not supported. See Mutating with User Defined Function (UDF)...
Read more >
How can I both resample and aggregate a raster using Terra?
You can first resample to a high resolution raster that is aligned with the low resolution raster and then use aggregate. Example data:...
Read more >
Using the Pandas “Resample” Function - Towards Data Science
This argument does not change the underlying calculation, it just relabels the output based on the desired edge once the aggregation is ...
Read more >
Pandas Resample – pd.df.resample() - Data Independent
Pandas Resample is an amazing function that does more than you think. This powerful tool will help you transform and clean up your...
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