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

getItem

配列またはマップの列から項目を取得します。

構文

Python
getItem(key)

パラメーター

パラメーター

Type

説明

key

Value

配列のインデックスまたはマップのキー

戻り値

Python
df = spark.createDataFrame([([1, 2], {"key": "value"})], ["l", "d"])
df.select(df.l.getItem(0), df.d.getItem("key")).show()
Output
# +----+------+
# |l[0]|d[key]|
# +----+------+
# | 1| value|
# +----+------+
このページの見出し