_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › RDD一
|
|
pyspark襯 襦 built-in 襯 蟆 譬.
蠏碁讌 朱 JVM り るる螳 覦 . [edit]
2.1 textFile() #c:\data\test.txt殊 2螳 一 RDD襯 襷.
lines = sc.textFile("c:\\data\\test.txt", 2) lines.collect() [edit]
2.3 union() #2螳 RDD 豺蠍, 3螳 RDD 豺蠍
lines1 = sc.parallelize(['a', 'b', 'c']) lines2 = sc.parallelize(['d', 'e', 'f']) lines3 = sc.parallelize(['g', 'h', 'i']) lines = lines1.union(lines2).union(lines3) for line in lines.collect(): print(line) 蟆郁骸
>>> lines1 = sc.parallelize(['a', 'b', 'c']) >>> lines2 = sc.parallelize(['d', 'e', 'f']) >>> lines3 = sc.parallelize(['g', 'h', 'i']) >>> lines = lines1.union(lines2).union(lines3) >>> for line in lines.collect(): ... print(line) ... a b c d e f g h i >>> [edit]
2.4 filter() #lines = sc.parallelize(['螳讌', '覓', '覦一', '豢']) choo = lines.filter(lambda x: "豢" in x) choo.collect() 蟆郁骸
>>> lines = sc.parallelize(['螳讌', '覓', '覦一', '豢']) >>> choo = lines.filter(lambda x: "豢" in x) >>> choo.collect() ['覦一', '豢'] >>>
鏤
|
覈 殊 襷れ企 蟆覲企 覿 蟆 蟇語 蟆企. |