I need help on how to call TeamCt and SeniorCt functions and get the two total values into def Main function using Python Pyspark.
def Main(source1):
def TeamCt(source1):
north_total = source1
.filter(F.col(‘team’) == ‘North’)
.groupBy(F.col(‘team’))
.agg(F.count(‘*’).alias(‘n_total’)
return north_total
def SeniorCt(source1):
senior_total = source1
.filter(F.col(‘grade’) == ‘Senior’)
.groupBy(F.col(‘grade’))
.agg(F.count(‘*’).alias(‘s_total’)
return senior_total
Hope this works:
def Main(source1):
north_total = TeamCt(source1)
senior_total = SeniorCt(source1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.