Skip to content

Introduction to Statistics in Python

Run the hidden code cell below to import the data used in this course.

# Importing numpy and pandas
import numpy as np
import pandas as pd

# Importing the course datasets
deals = pd.read_csv("datasets/amir_deals.csv")
happiness = pd.read_csv("datasets/world_happiness.csv")
food = pd.read_csv("datasets/food_consumption.csv")

Take Notes

Add notes about the concepts you've learned and code cells with code you want to keep.

Add your notes here

# Add your code snippets here
from scipy.stats import norm

We have to samples

  1. With replacement In this case it's not really important to choose any sample
  2. Without replacement

Bit in this case each choose depends on previos one

We can calculate the probability of action using scipy.stats

  • uniform distribution

for fair dice, or coin

  • continious uniform distribution (uniform.rvs, uniform.cdf)

for waiting bus

  • binomial distribution (binom.rvs, binom.cdf, binom.pmf)

for variable with 2 probabal ways, deals = win or loose

  • normal distribution (norm.cdf(sum, mean, sd), norm.ppf(pct, mean, sd))

Use when you have to know: What's the probability of Amir closing a deal worth less than $7500 if mean 5000 and std 2000? norm.cdf(7500, 5000, 2000)

Or you have to know how much is percent: What amount will 25% of Amir's sales be less than?

norm.ppf(0.25, 5000, 2000)

norm.cdf(7500, 5000, 2000), norm.ppf(0.25, 5000, 2000)