Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pyspark.RDD.flatMapValues#

RDD.flatMapValues(f)[source]#

Pass each value in the key-value pair RDD through a flatMap functionwithout changing the keys; this also retains the original RDD’spartitioning.

New in version 0.7.0.

Parameters
ffunction

a function to turn a V into a sequence of U

Returns
RDD

aRDD containing the keys and the flat-mapped value

Examples

>>>rdd=sc.parallelize([("a",["x","y","z"]),("b",["p","r"])])>>>deff(x):returnx...>>>rdd.flatMapValues(f).collect()[('a', 'x'), ('a', 'y'), ('a', 'z'), ('b', 'p'), ('b', 'r')]

[8]ページ先頭

©2009-2025 Movatter.jp