Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pyspark group by and average in dataframes

df.groupBy("Profession").agg({'Age':'avg', 'Gender':'count'}).show()
Comment

pyspark average group by

from pyspark.sql import functions as F
df.groupBy("Profession").agg(F.mean('Age'), F.count('Age')).show()
Comment

PREVIOUS NEXT
Code Example
Python :: multiprocessing in jupyter notebook 
Python :: how to check if a variable holds a class reference in python 
Python :: python panda count excel sheet 
Python :: how to convert string to integer in python 
Python :: get reactions from message discord.py 
Python :: color plt 
Python :: how to write a comment in python 
Python :: calculate quantiles python 
Python :: dash log scale 
Python :: pandas resample friday 
Python :: tensorflow.keras.utils.to_categorical 
Python :: iterate over a list python 
Python :: df concat multiple columns 
Python :: python os get dir path 
Python :: lambda in python 
Python :: code 
Python :: permutation of a string in python 
Python :: django from 
Python :: how to convert pandas price column to integer 
Python :: hist pandas 
Python :: video steganography using python 
Python :: python to linux executable 
Python :: dataframe summarize how many in each column 
Python :: pandas if value present in df index 
Python :: 16 bit floating point numpy 
Python :: print to file python 
Python :: how to get session value in django template 
Python :: python linear fit 
Python :: pandas read csv file 
Python :: python django query 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =