Skip to content

Commit 3f07a8f

Browse files
author
MomIsBestFriend
committed
Fixes for jbrockmendel review
1 parent 936c94b commit 3f07a8f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pandas/core/nanops.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def _has_infs(result) -> bool:
167167

168168

169169
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,
171173
):
172174
""" return the correct fill value for the dtype of the values """
173175
if fill_value is not None:
@@ -652,7 +654,7 @@ def _get_counts_nanvar(
652654
mask: Optional[np.ndarray],
653655
axis: Optional[int],
654656
ddof: int,
655-
dtype: Dtype = float,
657+
dtype=float,
656658
) -> Tuple[Union[int, np.ndarray], Union[int, np.ndarray]]:
657659
""" Get the count of non-null values along an axis, accounting
658660
for degrees of freedom.
@@ -1135,7 +1137,7 @@ def nanprod(
11351137
skipna: bool = True,
11361138
min_count: int = 0,
11371139
mask: Optional[np.ndarray] = None,
1138-
) -> Dtype:
1140+
):
11391141
"""
11401142
Parameters
11411143
----------
@@ -1148,18 +1150,14 @@ def nanprod(
11481150
11491151
Returns
11501152
-------
1151-
result : dtype
1153+
The product of all elements on a given axis. ( NaNs are treated as 1)
11521154
11531155
Examples
11541156
--------
11551157
>>> import pandas.core.nanops as nanops
11561158
>>> s = pd.Series([1, 2, 3, np.nan])
11571159
>>> nanops.nanprod(s)
11581160
6.0
1159-
1160-
Returns
1161-
-------
1162-
The product of all elements on a given axis. ( NaNs are treated as 1)
11631161
"""
11641162
mask = _maybe_get_mask(values, skipna, mask)
11651163

@@ -1305,8 +1303,9 @@ def nancorr(
13051303
return f(a, b)
13061304

13071305

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
13101309
from scipy.stats import kendalltau, spearmanr
13111310
elif callable(method):
13121311
return method

0 commit comments

Comments
 (0)