Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #Creating df that creates the datetime range
  2.  
  3. range_max = rtbinds['pricedate'].max()
  4. range_min = range_max - datetime.timedelta(days=7)
  5.  
  6. sliced_df = rtbinds[(rtbinds['pricedate'] >= range_min) & (rtbinds['pricedate'] <= range_max)]
  7.  
  8. #grouping by 'shadow'
  9.  
  10. sliced_df.groupby(['pricedate','cons_name']).aggregate(np.mean).sort_values('shadow').head(10)
  11.  
  12. #returns for the first week of data.
  13. pricedate cons_name shadow
  14. 2019-04-26 TEMP71_24753 -643.691
  15. 2019-04-27 TMP175_24736 -508.062
  16. 2019-04-25 TMP109_22593 -383.263
  17. 2019-04-23 TEMP48_24759 -376.967
  18. 2019-04-29 TEMP71_24753 -356.476
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement