メインコンテンツまでスキップ

(列)で始まる

文字列列が部分文字列で始まっているかどうかを確認します。

構文

Python
startswith(other)

パラメーター

パラメーター

Type

説明

other

文字列または列

チェック対象の接頭辞を含む文字列または列

戻り値

列(ブール値)

Python
df = spark.createDataFrame(
[(2, "Alice"), (5, "Bob")], ["age", "name"])
df.filter(df.name.startswith('Al')).collect()
Output
# [Row(age=2, name='Alice')]
Python
df.filter(df.name.startswith('^Al')).collect()
Output
# []
このページの見出し