Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mberrien-fitzsimons/e78908bb31bbe3eb81fa0a8493c07a0a to your computer and use it in GitHub Desktop.
Save mberrien-fitzsimons/e78908bb31bbe3eb81fa0a8493c07a0a to your computer and use it in GitHub Desktop.
# Add days of the week
msft_proc['day_of_week'] = msft_proc['timestamp'].dt.day_name()
# create dummy variables
dummies = pd.get_dummies(msft_proc['day_of_week'])
# drop original days of the week column from the original dataframe
msft_proc.drop(columns=['day_of_week'], inplace=True)
# add two dataframes together
msft_proc = pd.concat([msft_proc, dummies], axis=1)
# we are only interested in running a regression of volume against the dummy variables
# for days of the week. Because of this we will drop the remaining variables before
# importing it to our processed data folder
msft_proc.drop(columns=['timestamp', 'open', 'high', 'low', 'close',
'adjusted_close','dividend_amount', 'split_coefficient'],
inplace=True)
msft_proc.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment