Skip to content

Commit 6e08c29

Browse files
authored
TYP: Typing fixes and improvements related to scipy.interpolate (#62211)
1 parent 3e1d6d5 commit 6e08c29

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pandas/core/missing.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@
4545
)
4646

4747
if TYPE_CHECKING:
48+
from typing import TypeAlias
49+
4850
from pandas import Index
4951

52+
_CubicBC: TypeAlias = Literal["not-a-knot", "clamped", "natural", "periodic"]
53+
5054

5155
def check_value_size(value, mask: npt.NDArray[np.bool_], length: int):
5256
"""
@@ -652,7 +656,7 @@ def _akima_interpolate(
652656
xi: np.ndarray,
653657
yi: np.ndarray,
654658
x: np.ndarray,
655-
der: int | list[int] | None = 0,
659+
der: int = 0,
656660
axis: AxisInt = 0,
657661
):
658662
"""
@@ -673,10 +677,8 @@ def _akima_interpolate(
673677
x : np.ndarray
674678
Of length M.
675679
der : int, optional
676-
How many derivatives to extract; None for all potentially
677-
nonzero derivatives (that is a number equal to the number
678-
of points), or a list of derivatives to extract. This number
679-
includes the function value as 0th derivative.
680+
How many derivatives to extract. This number includes the function
681+
value as 0th derivative.
680682
axis : int, optional
681683
Axis in the yi array corresponding to the x-coordinate values.
682684
@@ -702,9 +704,9 @@ def _cubicspline_interpolate(
702704
yi: np.ndarray,
703705
x: np.ndarray,
704706
axis: AxisInt = 0,
705-
bc_type: str | tuple[Any, Any] = "not-a-knot",
706-
extrapolate=None,
707-
):
707+
bc_type: _CubicBC | tuple[Any, Any] = "not-a-knot",
708+
extrapolate: Literal["periodic"] | bool | None = None,
709+
) -> np.ndarray:
708710
"""
709711
Convenience function for cubic spline data interpolator.
710712

0 commit comments

Comments
 (0)