-1
df['USDT_volume'].groupby(pd.Grouper(freq='60min', key=df['Datetime'])).mean().dropna()

my error: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

alec_djinn
  • 10,104
  • 8
  • 46
  • 71
  • Please, provide a minimal reproducible example https://stackoverflow.com/help/minimal-reproducible-example and https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples – alec_djinn Aug 29 '22 at 12:32

1 Answers1

0

the key parameter of pandas.Grouper should be a string, not a Series:

pd.Grouper(freq='60min', key='Datetime')

full command:

df.groupby(pd.Grouper(freq='60min', key='Datetime'))['USDT_volume'].mean().dropna()
mozway
  • 194,879
  • 13
  • 39
  • 75