I have mod_df data frame with various symbols and its corresponding prices. ['Lower Low']: is a column which is used to find the Lower Low price values, & I use the below code & it works fine.
mod_df['Lower Low'] = np.where((mod_df['Helper_L'] != mod_df['Helper_L'].shift(-1))
& (mod_df['Price'] < mod_df['Price'].shift(1))
& (mod_df['Price'] < mod_df['Price'].shift(-1)), 'Lower Low', '')
Since I have different Symbols in Symbols column, I'm trying to use groupby and Lambda function using the below code but I get the error:
TypeError: mod..() missing 1 required positional argument: 'y'
mod_df['Lower Low'] = mod_df.groupby('Symbol')[['Helper_L', 'Price']].transform(lambda x, y: (np.where((x != x.shift(-1)) & (y < y.shift(1)) & (y < y.shift(-1)), 'Lower Low', '')))
could anyone suggest how to fix this