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

(列)を含む

文字列列に部分文字列が含まれているかどうかを確認します。

構文

Python
contains(other)

パラメーター

パラメーター

Type

説明

other

文字列または列

検索する部分文字列を含む文字列または列

戻り値

列(ブール値)

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