pyspark.sql.Column.between

Column.between(lowerBound: Union[Column, LiteralType, DateTimeLiteral, DecimalLiteral], upperBound: Union[Column, LiteralType, DateTimeLiteral, DecimalLiteral]) → Column

True if the current column is between the lower bound and upper bound, inclusive.

Examples

>>> df.select(df.name, df.age.between(2, 4)).show()
+-----+---------------------------+
| name|((age >= 2) AND (age <= 4))|
+-----+---------------------------+
|Alice|                       true|
|  Bob|                      false|
+-----+---------------------------+