Код: Выделить всё
open high low close Volume USD
date
2021-07-10 21:00:00 132.060 133.350 131.885 133.195 259057.35815
2021-07-10 22:00:00 133.195 134.160 132.885 134.045 813078.76500
2021-07-10 23:00:00 134.045 134.620 133.690 133.995 338032.62200
2021-07-11 00:00:00 133.995 135.515 133.745 134.390 560713.74425
Код: Выделить всё
df.resample('2H').agg({
'open': 'first',
'high': 'max',
'low': 'min',
'close': 'last',
'Volume USD': 'sum'
})
Код: Выделить всё
open high low close Volume USD
date
2021-07-10 20:00:00 132.060 133.350 131.885 133.195 2.590574e+05
2021-07-10 22:00:00 133.195 134.620 132.885 133.995 1.151111e+06
2021-07-11 00:00:00 133.995 135.515 133.745 134.390 5.607137e+05
Большое спасибо за вашу помощь!>
Подробнее здесь: https://stackoverflow.com/questions/686 ... -ohlc-data
Мобильная версия