DEV Community

Durga Pokharel
Durga Pokharel

Posted on

Day 63 Of 100DaysOfCode: Pandas Dispersion

This is my 63th day of #100DaysOfcode and #python learning. Like yesterday today continue to learn from datacamp about pandas. Here is code for inter quantile range.

Pandas code

# Calculate mean
mean = income['Income per Capita'].mean()

# Calculate standard deviation
std = income['Income per Capita'].std()

# Calculate and print lower and upper bounds
bounds = [mean-std,mean + std]
print(bounds)

# Calculate and print first and third quartiles
quantiles = income['Income per Capita'].quantile([0.25, 0.75])
print(quantiles)

# Calculate and print IQR
iqr = quantiles[0.75] - quantiles[0.25]
print(iqr)
Enter fullscreen mode Exit fullscreen mode

Day 63 Of #100DaysOfCode and #python
* Pandas (Dispersion) from https://t.co/EAEFp0OZwYDatacamp#womenintech #100DaysOfCode #CodeNewbie #DEVCommunity pic.twitter.com/EJSKaXbrgF

— Durga Pokharel (@mathdurga) March 1, 2021

Top comments (0)