Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Creating df that creates the datetime range
- range_max = rtbinds['pricedate'].max()
- range_min = range_max - datetime.timedelta(days=7)
- sliced_df = rtbinds[(rtbinds['pricedate'] >= range_min) & (rtbinds['pricedate'] <= range_max)]
- #grouping by 'shadow'
- sliced_df.groupby(['pricedate','cons_name']).aggregate(np.mean).sort_values('shadow').head(10)
- #returns for the first week of data.
- pricedate cons_name shadow
- 2019-04-26 TEMP71_24753 -643.691
- 2019-04-27 TMP175_24736 -508.062
- 2019-04-25 TMP109_22593 -383.263
- 2019-04-23 TEMP48_24759 -376.967
- 2019-04-29 TEMP71_24753 -356.476
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement