What am i doing wrong in the code below:
I have tried to wrap everything in parenthensis but still gets an error. any help would be appreciated.
#Calculate slippage for buy orders
aapl_1m['slippage_buy_order'] = (aapl_1m['High'] - aapl_1m['Close']) / aapl_1m['Close']
#Calculate slippage for sell orders
aapl_1m['slippage_sell_order'] = (aapl_1m['Close'] - aapl_1m['Low']) / aapl_1m['Close']
#Mean of the slippage for buy and sell orders for each day
aapl_1m = aapl_1m.groupby([aapl_1m['Date'].dt.date]).mean
aapl_1m
I am getting this error message:
TypeError Traceback (most recent call last) <ipython-input-32-1931dbd8d2a6> in <module> 1 #Calculate slippage for buy orders 2 ----> 3 aapl_1m['slippage_buy_order'] = (aapl_1m['High'] - aapl_1m['Close']) / aapl_1m['Close'] 4 5 #Calculate slippage for sell orders TypeError: 'method' object is not subscriptable