@@ -692,20 +692,20 @@ def nanmean(
692
692
values , mask , dtype , dtype_max , _ = _get_values (
693
693
values , skipna , fill_value = 0 , mask = mask
694
694
)
695
- dtype_sum = dtype_max
695
+ # dtype_sum = dtype_max
696
696
dtype_count = np .dtype (np .float64 )
697
697
698
698
# not using needs_i8_conversion because that includes period
699
- if dtype .kind in ["m" , "M" ]:
700
- dtype_sum = np .dtype (np .float64 )
701
- elif is_integer_dtype (dtype ):
702
- dtype_sum = np .dtype (np .float64 )
703
- elif is_float_dtype (dtype ):
704
- dtype_sum = dtype
705
- dtype_count = dtype
699
+ # if dtype.kind in ["m", "M"]:
700
+ # dtype_sum = np.dtype(np.float64)
701
+ # elif is_integer_dtype(dtype):
702
+ # dtype_sum = np.dtype(np.float64)
703
+ # elif is_float_dtype(dtype):
704
+ # dtype_sum = dtype
705
+ # dtype_count = dtype
706
706
707
707
count = _get_counts (values .shape , mask , axis , dtype = dtype_count )
708
- the_sum = _ensure_numeric (values .sum (axis , dtype = dtype_sum ))
708
+ the_sum = _ensure_numeric (values .sum (axis , dtype = np . float64 ))
709
709
710
710
if axis is not None and getattr (the_sum , "ndim" , False ):
711
711
count = cast (np .ndarray , count )
@@ -911,9 +911,10 @@ def nanstd(
911
911
912
912
orig_dtype = values .dtype
913
913
values , mask , _ , _ , _ = _get_values (values , skipna , mask = mask )
914
-
915
914
result = np .sqrt (nanvar (values , axis = axis , skipna = skipna , ddof = ddof , mask = mask ))
916
- return _wrap_results (result , orig_dtype )
915
+ # return _wrap_results(result, np.orig_dtype)
916
+ return result
917
+
917
918
918
919
919
920
@disallow ("M8" , "m8" )
@@ -961,10 +962,10 @@ def nanvar(
961
962
if mask is not None :
962
963
values [mask ] = np .nan
963
964
964
- if is_float_dtype (values .dtype ):
965
- count , d = _get_counts_nanvar (values .shape , mask , axis , ddof , values .dtype )
966
- else :
967
- count , d = _get_counts_nanvar (values .shape , mask , axis , ddof )
965
+ # if is_float_dtype(values.dtype):
966
+ # count, d = _get_counts_nanvar(values.shape, mask, axis, ddof, values.dtype)
967
+ # else:
968
+ count , d = _get_counts_nanvar (values .shape , mask , axis , ddof )
968
969
969
970
if skipna and mask is not None :
970
971
values = values .copy ()
@@ -979,16 +980,16 @@ def nanvar(
979
980
avg = _ensure_numeric (values .sum (axis = axis , dtype = np .float64 )) / count
980
981
if axis is not None :
981
982
avg = np .expand_dims (avg , axis )
982
- sqr = _ensure_numeric ((avg - values ) ** 2 )
983
+ sqr = _ensure_numeric ((np . subtract ( avg , values , dtype = np . float64 ) ) ** 2 )
983
984
if mask is not None :
984
985
np .putmask (sqr , mask , 0 )
985
986
result = sqr .sum (axis = axis , dtype = np .float64 ) / d
986
987
987
988
# Return variance as np.float64 (the datatype used in the accumulator),
988
989
# unless we were dealing with a float array, in which case use the same
989
990
# precision as the original values array.
990
- if is_float_dtype (dtype ):
991
- result = result .astype (dtype , copy = False )
991
+ # if is_float_dtype(dtype):
992
+ # result = result.astype(dtype, copy=False)
992
993
return result
993
994
994
995
0 commit comments