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 :: iter() python 
Python :: python pathlib create directory if not exists 
Python :: python location 
Python :: python find directory of file 
Python :: OneHotEncoder() 
Python :: Date Time split in python 
Python :: python3 ngrok.py 
Python :: dockerfile for django project 
Python :: how to check the size of a file in python 
Python :: python mixins 
Python :: only keep rows of a dataframe based on a column value 
Python :: python cv2 convert image to binary 
Python :: find the index of a character in a string python 
Python :: http server in python 
Python :: pd df append 
Python :: delete tuple from list python 
Python :: check if point is inside polygon python 
Python :: what does int do in python 
Python :: streamlit button 
Python :: random torch tensor 
Python :: check if there are duplicates in list 
Python :: levenshtein distance 
Python :: split a string with 2 char each in python 
Python :: how to use cv2.COLOR_BGR2GRAY 
Python :: Python NumPy repeat Function Syntax 
Python :: connect to spark cluster 
Python :: python bit shift by 3 
Python :: python find string 
Python :: dictionary with list as value py 
Python :: how to check if a file exists in python 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =