今天写pyspark遇到一个问题,要实现同mysql的GROUP_CONCAT函数的功能 数据1: col1 col2 1 a 1 b 1 c 2 d 2 f 想要的结果1: col1 new_col2 1 a,b,c 2 d,f 如果存在多列是否也可行 数据2: col1 col2 col3 1 a 100 1 b 200 1 c 300 2 d 400 2 f 500 想要的结果2: col1 new_col2...
from pyspark.sql.functions import concat_ws, col df = spark.createDataFrame([["A", "B"], ["C", None], [None, "D"]]).toDF("Type", "Segment") #display(df) df = df.withColumn("concat_ws2", concat_ws(':', coalesce('Type', lit("")), coalesce('Segment', lit(""))) displ...
PySpark 3.3.0在使用Pandas API执行concat时没有使用缓存的DataFrame这并不是最大的速度差异,所以这可...
PySpark 3.3.0在使用Pandas API执行concat时没有使用缓存的DataFrame这并不是最大的速度差异,所以这可...
一.问题描述 今天写pyspark遇到一个问题,要实现同mysql的GROUP_CONCAT函数的功能 数据1: 想要的结果1: 如果存在多列是否也可行数据2: 想要的结果2...