ylxw
V2EX  ›  问与答

pyspark dataframe array 列求和

  •  
  •   ylxw · Oct 12, 2018 · 4095 views
    This topic created in 2949 days ago, the information mentioned may be changed or developed.
    pyspark dataframe 中其中一列的数据类型为 ArrayType(IntegerType()),如何对这列求和

    如:
    +----------------+
    | x|
    +----------------+
    |[[1, 5], [1, 5]]|
    |[[0, 1], [0, 1]]|
    |[[4, 5], [4, 5]]|
    +----------------+
    如何将求 x 列的总和,得到[[5,11],[5,11]]
    1 replies  •  2018-10-16 10:44:59 +08:00
    ylxw
    ylxw
    OP
    Oct 16, 2018
    1
    装换为 rdd,使用累加器进行求和
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   849 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 17:09 · PVG 01:09 · LAX 09:09 · JFK 12:09
    ♥ Do have faith in what you're doing.