diff --git a/py-polars/polars/expr/expr.py b/py-polars/polars/expr/expr.py index de83d8da4da7..43468daa2f5b 100644 --- a/py-polars/polars/expr/expr.py +++ b/py-polars/polars/expr/expr.py @@ -143,8 +143,13 @@ def __str__(self) -> str: def __bool__(self) -> NoReturn: msg = ( "the truth value of an Expr is ambiguous" - "\n\nHint: use '&' or '|' to logically combine Expr, not 'and'/'or', and" - " use `x.is_in([y,z])` instead of `x in [y,z]` to check membership." + "\n\n" + "You probably got here by using a Python standard library function instead " + "of the native expressions API.\n" + "Here are some things you might want to try:\n" + "- instead of `pl.col('a') and pl.col('b')`, use `pl.col('a') & pl.col('b')`\n" + "- instead of `pl.col('a') in [y, z]`, use `pl.col('a').is_in([y, z])`\n" + "- instead of `max(pl.col('a'), pl.col('b'))`, use `pl.max_horizontal(pl.col('a'), pl.col('b'))`\n" ) raise TypeError(msg)