Home > Blockchain >  Sort the arrays foreach row in pyspark dataframe
Sort the arrays foreach row in pyspark dataframe

Time:06-12

i need to sort the lignes of pyspark data frame , the only solutions that i found is how to sort a whole column . To be more clear , i want this

:  my dataframe

to give me : [3 , 19]
with no changes in the order of column Thank you

CodePudding user response:

i found this solution and it worked with me :

from pyspark.sql.functions import array_sort
dataframe = dataframe.withColumn('column name', F.array_sort('column name'))
  • Related