def normprob(z, direction='two-sided', mean=0, std=1):
 if (direction == 'two-sided'):
  if (z >= 0):
   return (2 * (1.0 - norm.cdf(z, mean, std)))
  else:
   return (2 * norm.cdf(z, mean, std))
 elif (direction == 'high'):
  return (1 - norm.cdf(z, mean, std))
 elif (direction == 'low'):
  return norm.cdf(z, mean, std)
 else:
  raise ValueError('Unknown direction.')

def normprob ( z , direction = 'two-sided' , mean = 0 , std = 1 ) : if ( direction == 'two-sided' ) : if ( z >= 0 ) : return ( 2 * ( 1.0 - norm . cdf ( z , mean , std ) ) ) else : return ( 2 * norm . cdf ( z , mean , std ) ) elif ( direction == 'high' ) : return ( 1 - norm . cdf ( z , mean , std ) ) elif ( direction == 'low' ) : return norm . cdf ( z , mean , std ) else : raise ValueError ( 'Unknown direction.' )
calculate probability from normal distribution paramaters z : float value of z statistic direction : str one of low .