Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. """freq=H: Calculates the returns of each row relative to 1 row(s) before."""
  2. daily_data2016to2018_df.pct_change(freq='H').head()
  3.  
  4. """freq=4H: Calculates the returns of each row relative to 4 row(s) before."""
  5. daily_data2016to2018_df.pct_change(freq='4H').head(10)
  6.  
  7. """freq=D: Calculates the returns of each row relative to 24 row(s) before."""
  8. daily_data2016to2018_df.pct_change(freq='D').head(30)
  9.  
  10. """freq=W: Calculates the returns of each row relative to 24*7 row(s) before."""
  11. daily_data2016to2018_df.pct_change(freq='W').head(30)
  12.  
  13. """I don't understand why frequencies greater than a day aren't working.
  14. I could see why frequencies less than an hour wouldn't work because
  15. the data isn't that granular, but why not weekly, monthly, etc.?"""
  16. daily_data2016to2018_df.pct_change(freq='M')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement