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

(列)で終了

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

構文

Python
endswith(other)

パラメーター

パラメーター

Type

説明

other

文字列または列

チェックする接尾辞を含む文字列または列

戻り値

列(ブール値)

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