Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Check if a string column starts with a substring.
Syntax
startswith(other)
Parameters
| Parameter | Type | Description |
|---|---|---|
other |
str or Column | String or Column containing the prefix to check |
Returns
Column (boolean)
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()
# []