I have a dataframe of values and I would like to explore the rows that are outliers. I wrote a function below that can be called with the groupby().apply() func
You need to use | instead of or. The and and or operators are special in Python and don't interact well with things like numpy and pandas that try to apply to them elementwise across a collection. So for these contexts, they've redefined the "bitwise" operators & and | to mean "and" and "or".