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

colRegex

正規表現で指定された列名に基づいて列を選択し、 Columnとして返します。

構文

colRegex(colName: str)

パラメーター

パラメーター

Type

説明

colName

str

文字列。列名は正規表現で指定します。

戻り値

Column

Python
df = spark.createDataFrame([("a", 1), ("b", 2), ("c",  3)], ["Col1", "Col2"])
df.select(df.colRegex("`(Col1)?+.+`")).show()
# +----+
# |Col2|
# +----+
# | 1|
# | 2|
# | 3|
# +----+
このページの見出し