@@ -167,7 +167,9 @@ def _has_infs(result) -> bool:
167
167
168
168
169
169
def _get_fill_value (
170
- dtype : Dtype , fill_value : Any = None , fill_value_typ : Optional [str ] = None
170
+ dtype : Dtype ,
171
+ fill_value : Optional [Scalar ] = None ,
172
+ fill_value_typ : Optional [str ] = None ,
171
173
):
172
174
""" return the correct fill value for the dtype of the values """
173
175
if fill_value is not None :
@@ -652,7 +654,7 @@ def _get_counts_nanvar(
652
654
mask : Optional [np .ndarray ],
653
655
axis : Optional [int ],
654
656
ddof : int ,
655
- dtype : Dtype = float ,
657
+ dtype = float ,
656
658
) -> Tuple [Union [int , np .ndarray ], Union [int , np .ndarray ]]:
657
659
""" Get the count of non-null values along an axis, accounting
658
660
for degrees of freedom.
@@ -1135,7 +1137,7 @@ def nanprod(
1135
1137
skipna : bool = True ,
1136
1138
min_count : int = 0 ,
1137
1139
mask : Optional [np .ndarray ] = None ,
1138
- ) -> Dtype :
1140
+ ):
1139
1141
"""
1140
1142
Parameters
1141
1143
----------
@@ -1148,18 +1150,14 @@ def nanprod(
1148
1150
1149
1151
Returns
1150
1152
-------
1151
- result : dtype
1153
+ The product of all elements on a given axis. ( NaNs are treated as 1)
1152
1154
1153
1155
Examples
1154
1156
--------
1155
1157
>>> import pandas.core.nanops as nanops
1156
1158
>>> s = pd.Series([1, 2, 3, np.nan])
1157
1159
>>> nanops.nanprod(s)
1158
1160
6.0
1159
-
1160
- Returns
1161
- -------
1162
- The product of all elements on a given axis. ( NaNs are treated as 1)
1163
1161
"""
1164
1162
mask = _maybe_get_mask (values , skipna , mask )
1165
1163
@@ -1305,8 +1303,9 @@ def nancorr(
1305
1303
return f (a , b )
1306
1304
1307
1305
1308
- def get_corr_func (method : str ):
1309
- if method in ["kendall" , "spearman" ]:
1306
+ def get_corr_func (method ) -> Callable :
1307
+ if method in ["kendall" , "spearman" , "pearson" ]:
1308
+ import scipy .stats
1310
1309
from scipy .stats import kendalltau , spearmanr
1311
1310
elif callable (method ):
1312
1311
return method
0 commit comments