Column.
startswith
String starts with. Returns a boolean Column based on a string match.
Column
Changed in version 3.4.0: Supports Spark Connect.
string at start of line (do not use a regex ^)
Examples
>>> df = spark.createDataFrame( ... [(2, "Alice"), (5, "Bob")], ["age", "name"]) >>> df.filter(df.name.startswith('Al')).collect() [Row(age=2, name='Alice')] >>> df.filter(df.name.startswith('^Al')).collect() []