Is there any way to get the percentage change from the open on minute data. I did the following, however i think it is over complicated, and it only works in my notebook. Any ideas/help will be appreciative.
def make_data(stock):
x = stock.between_time('13:31','13:31')
stock['date'] = np.nan
stock['date'] = stock.index.date
x['date'] = np.nan
x['date'] = x.index.date
df = pd.merge(stock,x,on = ['date'],right_index= True)
# Select the ones you want
df = df[['price_x','open_price_y']]
df= df.rename(columns={'price_x': 'price', 'open_price_y': 'open'})
df['return'] = np.nan
df['return'] = (df['price']-df['open'])/df['open']
return df