Skip to content

Commit 70d2c4e

Browse files
authored
statistics: add kde, kde_random in py313 (#11941)
1 parent 2ae611a commit 70d2c4e

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

stdlib/statistics.pyi

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import SupportsRichComparisonT
3-
from collections.abc import Hashable, Iterable, Sequence
3+
from collections.abc import Callable, Hashable, Iterable, Sequence
44
from decimal import Decimal
55
from fractions import Fraction
66
from typing import Any, Literal, NamedTuple, SupportsFloat, TypeVar
@@ -28,6 +28,8 @@ __all__ = [
2828

2929
if sys.version_info >= (3, 10):
3030
__all__ += ["covariance", "correlation", "linear_regression"]
31+
if sys.version_info >= (3, 13):
32+
__all__ += ["kde", "kde_random"]
3133

3234
# Most functions in this module accept homogeneous collections of one of these types
3335
_Number: TypeAlias = float | Decimal | Fraction
@@ -130,3 +132,30 @@ if sys.version_info >= (3, 11):
130132

131133
elif sys.version_info >= (3, 10):
132134
def linear_regression(regressor: Sequence[_Number], dependent_variable: Sequence[_Number], /) -> LinearRegression: ...
135+
136+
if sys.version_info >= (3, 13):
137+
_Kernel: TypeAlias = Literal[
138+
"normal",
139+
"gauss",
140+
"logistic",
141+
"sigmoid",
142+
"rectangular",
143+
"uniform",
144+
"triangular",
145+
"parabolic",
146+
"epanechnikov",
147+
"quartic",
148+
"biweight",
149+
"triweight",
150+
"cosine",
151+
]
152+
def kde(
153+
data: Sequence[float], h: float, kernel: _Kernel = "normal", *, cumulative: bool = False
154+
) -> Callable[[float], float]: ...
155+
def kde_random(
156+
data: Sequence[float],
157+
h: float,
158+
kernel: _Kernel = "normal",
159+
*,
160+
seed: int | float | str | bytes | bytearray | None = None, # noqa: Y041
161+
) -> Callable[[], float]: ...

0 commit comments

Comments
 (0)