File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ def _ss(data, c=None):
234
234
# The sum will be a NAN or INF. We can ignore all the finite
235
235
# partials, and just look at this special one.
236
236
ssd = c = sx_partials [None ]
237
- assert not _isfinite (total )
237
+ assert not _isfinite (ssd )
238
238
else :
239
239
sx = sum (Fraction (n , d ) for d , n in sx_partials .items ())
240
240
sxx = sum (Fraction (n , d * d ) for d , n in sxx_partials .items ())
@@ -945,7 +945,11 @@ def _mean_stdev(data):
945
945
if n < 2 :
946
946
raise StatisticsError ('stdev requires at least two data points' )
947
947
mss = ss / (n - 1 )
948
- return float (xbar ), _float_sqrt_of_frac (mss .numerator , mss .denominator )
948
+ try :
949
+ return float (xbar ), _float_sqrt_of_frac (mss .numerator , mss .denominator )
950
+ except AttributeError :
951
+ # Handle Nans and Infs gracefully
952
+ return float (xbar ), float (xbar ) / float (ss )
949
953
950
954
951
955
# === Statistics for relations between two inputs ===
You can’t perform that action at this time.
0 commit comments