How can I pivot on multiple columns separately in PySpark
stackoverflow.com › questions › 57145661Jul 22, 2019 · How can I pivot on multiple columns separately in PySpark. Is there a possibility to make a pivot for different columns at once in PySpark? I have a dataframe like this: from pyspark.sql import functions as sf import pandas as pd sdf = spark.createDataFrame ( pd.DataFrame ( [ [1, 'str1', 'str4'], [1, 'str1', 'str4'], [1, 'str2', 'str4'], [1 ...
python - How to pivot on multiple columns in Spark SQL ...
stackoverflow.com › questions › 45035940Jul 11, 2017 · I need to pivot more than one column in a PySpark dataframe. Sample dataframe: from pyspark.sql import functions as F d = [ (100,1,23,10), (100,2,45,11), (100,3,67,12), (100,4,78,13), (101,1,23,10), (101,2,45,13), (101,3,67,14), (101,4,78,15), (102,1,23,10), (102,2,45,11), (102,3,67,16), (102,4,78,18)] mydf = spark.createDataFrame (d, ['id ...