Skip to content

Instantly share code, notes, and snippets.

@anbento0490
Created May 3, 2020 08:23
Show Gist options
  • Save anbento0490/7468e1c997136fcb7fb41e28f1d6e97d to your computer and use it in GitHub Desktop.
Save anbento0490/7468e1c997136fcb7fb41e28f1d6e97d to your computer and use it in GitHub Desktop.
stocks['Lag1 pct'] = stocks.groupby('Symbol')['Adj Close'].pct_change(-1).round(2)
stocks['Lag7 pct'] = stocks.groupby('Symbol')['Adj Close'].pct_change(-7).round(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment