I'm filtering my rows from dataframe named joined on multiple criterias:
joined[(joined.gvkey_x==gvkey) & (year-3<=joined.year_y<=year )]
I want all the rows from the dataframe which satisfy the given conditions. I'm returned this error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
I was reading this answer which states that I should use .any()/ .all() but this isnt exactly clear.
Can someone explain to me how I should apply multiple conditions and what is exactly the purpose and use of a.any() or a.all() in my operation (&).
(joined.year_y >= year-3) & (joined.year_y <= year)