how to Select multiple columns using group BY is it possible "using one agg to a column in DF to return that Full DF with all columns " ? please explain this scenario once
you get the min or max salary in one DF and use the value of min or max salary and use join in diffrent DF for Eg: df1 = df.groupBy("department").agg(min("salary").alias("minSalary"),\ max("salary").alias("maxSalary")) resultDf = df.join(df1, [df.salary == df1.maxSalary],"inner") resultDf.show() Hope that helps :)
Hi Maheer, you are doing great job. Salute. Thank you
Thank you 😊
Great explanation Maheer. Can you please share the DDL of the dataframe in the description ? It will help all of us to practise.
Good vedios Maheer. Thanks for the pyspark vedios.
Thank you ☺️
how to Select multiple columns using group BY is it possible "using one agg to a column in DF to return that Full DF with all columns " ? please explain this scenario once
Completed 🎉🎉
Thanks bhaii....
Welcome 😇
sir, i have one doubt..if we want name and id of that person who is having max or min salary after group by, how can we calculate it in pyspark
Did you get the answer
not yet@@Thulasisingala-ih1oz..
you get the min or max salary in one DF and use the value of min or max salary and use join in diffrent DF for Eg: df1 = df.groupBy("department").agg(min("salary").alias("minSalary"),\
max("salary").alias("maxSalary"))
resultDf = df.join(df1, [df.salary == df1.maxSalary],"inner")
resultDf.show()
Hope that helps :)