column is not accessible using groupby and apply(lambda)
I’m encountering a KeyError
when trying to use the .apply()
method on a pandas DataFrame after performing a groupby
. The goal is to calculate the weighted average baced on the Industry_adjusted_return column. The error indicates that the 'Industry_adjusted_return'
column cannot be found. Below is a minimal example that reproduces the issue: