진지한 개발자

PySpark Preprocessing 본문

IT/spark

PySpark Preprocessing

제이_엔 2023. 8. 25. 11:29
728x90
# convert each row in DataFrame to list of integer
df.col_2 = df.col2.map(lambda x: [int(e) for e in x])

df_spark = spark.createDataFrame(df)
df_spark.select('col_1', explode(col('col_2')).alias('cols_2')).show(10)
728x90

'IT > spark' 카테고리의 다른 글

Pyspark 사용예 (HDFS)  (0) 2025.02.18
PySpark json flatten case  (0) 2023.08.25
PySpark의 UDF 예제  (0) 2023.07.31
PySpark 특징 및 장점  (0) 2023.07.31
Pyspark 예제 실행  (0) 2023.04.19