V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ylxw
V2EX  ›  问与答

pyspark dataframe array 列求和

  •  
  •   ylxw · Oct 12, 2018 · 3663 views
    This topic created in 2761 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
        1
    ylxw  
    OP
       Oct 16, 2018
    装换为 rdd,使用累加器进行求和
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2515 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 09:07 · PVG 17:07 · LAX 02:07 · JFK 05:07
    ♥ Do have faith in what you're doing.