def t_one_sample(a, popmean=0, tails='two-sided'):
 (t, _) = ttest_1samp(a, popmean)
 if (isnan(t) or isinf(t)):
  return (nan, nan)
 p = tprob(t, (len(a) - 1), tails)
 return (float(t), p)

def t_one_sample ( a , popmean = 0 , tails = 'two-sided' ) : ( t , _ ) = ttest_1samp ( a , popmean ) if ( isnan ( t ) or isinf ( t ) ) : return ( nan , nan ) p = tprob ( t , ( len ( a ) - 1 ) , tails ) return ( float ( t ) , p )
peform a one sample t-test against a given population mean .