# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
import pandas as pd
import numpy as np
import seaborn as sns

import matplotlib.pyplot as plt
import matplotlib
matplotlib.pyplot.style.use('seaborn')
matplotlib.rcParams['figure.figsize'] = (15, 5)

# %matplotlib inline

import math
import scipy

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"


# +
def z_score(v, mean, std):
    return (v - mean) / float(std)

def get_from_ztable(v):
    return 1 - scipy.stats.norm.sf(v)

def get_proportion(v1, v2, mean, std):
    return get_from_ztable(z_score(v2, mean, std)) - get_from_ztable(z_score(v1, mean, std))


# -

mean=170.4
std=10

z = z_score(170.5, mean=mean, std=std)
z

get_from_ztable(z)

get_proportion(170.5, 180.3, mean=mean, std=std)



StarcoderdataJupyterScriptsDedupFiltered