Calculating Common Statistics From a Pandas DataFrame Column

Python
Statistics & Probability

 1|  # sum
 2|  sum = df['col_A'].sum()
 3|  
 4|  # mean
 5|  mean = df['col_A'].mean()
 6|  
 7|  # count
 8|  count = df['col_A'].count()
 9|  
10|  # minimum
11|  min = df['col_A'].min()
12|  
13|  # maximum
14|  max = df['col_A'].max()
15|  
16|  # median
17|  median = df['col_A'].median()
18|  
19|  # standard deviation
20|  standard_deviation = df['col_A'].std()
21|  
22|  # variance
23|  variance = df['col_A'].var()
1 Upvote
Tags: Statistics
Did you find this snippet useful?

Sign up to bookmark this in your snippet library

Get z-score for a column and add to Datafame
Python
Statistics & Probability

Z-score

3
How to Calculate the Sampling Error
Python
Statistics & Probability

Sampling

1
Numpy Descriptive Statistics
Python
Statistics & Probability

1