Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Method to get column average

# Below are quick example
# Using DataFrame.mean() method to get column average
df2 = df["Fee"].mean()

# Using DataFrame.mean() to get entire column mean
df2 = df.mean()

# Using multiple columns mean using DataFrame.mean()
df2 = df[["Fee","Discount"]].mean()

# Average of each column using DataFrame.mean()
df2 = df.mean(axis=0)

# Find the mean including NaN values using DataFrame.mean()
df2 = df.mean(axis = 0, skipna = False)

# Using DataFrame.describe() method
df2 = df.describe()
Source by sparkbyexamples.com #
 
PREVIOUS NEXT
Tagged: #Method #column #average
ADD COMMENT
Topic
Name
1+8 =