def tprob(t, df, tails='high'):
 if (tails == 'two-sided'):
  if (t >= 0):
   return (2 * (1.0 - tdist.cdf(t, df)))
  else:
   return (2 * tdist.cdf(t, df))
 elif (tails == 'high'):
  return (1 - tdist.cdf(t, df))
 elif (tails == 'low'):
  return tdist.cdf(t, df)
 else:
  raise ValueError('Unknown direction.')

def tprob ( t , df , tails = 'high' ) : if ( tails == 'two-sided' ) : if ( t >= 0 ) : return ( 2 * ( 1.0 - tdist . cdf ( t , df ) ) ) else : return ( 2 * tdist . cdf ( t , df ) ) elif ( tails == 'high' ) : return ( 1 - tdist . cdf ( t , df ) ) elif ( tails == 'low' ) : return tdist . cdf ( t , df ) else : raise ValueError ( 'Unknown direction.' )
calculate probability from t distribution paramaters t : float value of t statistic tails : str one of low .