Skip to content

Instantly share code, notes, and snippets.

@anbento0490
Last active May 3, 2020 07:20
Show Gist options
  • Save anbento0490/60b0ee553e13cacd98dbd63c1ff78753 to your computer and use it in GitHub Desktop.
Save anbento0490/60b0ee553e13cacd98dbd63c1ff78753 to your computer and use it in GitHub Desktop.
stocks['Lag1'] = stocks.groupby('Symbol')['Adj Close'].shift(-1)
stocks['Lag7'] = stocks.groupby('Symbol')['Adj Close'].shift(-7)
stocks.head(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment