Files
typeshed/stdlib/3/statistics.pyi
Sebastian Rittau 0501e2b329 Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
2019-10-14 09:53:48 +02:00

65 lines
2.8 KiB
Python

# Stubs for statistics
from decimal import Decimal
from fractions import Fraction
import sys
from typing import Any, Iterable, List, Optional, SupportsFloat, Type, TypeVar, Union
_T = TypeVar("_T")
# Most functions in this module accept homogeneous collections of one of these types
_Number = TypeVar('_Number', float, Decimal, Fraction)
class StatisticsError(ValueError): ...
if sys.version_info >= (3, 8):
def fmean(data: Iterable[SupportsFloat]) -> float: ...
def geometric_mean(data: Iterable[SupportsFloat]) -> float: ...
def mean(data: Iterable[_Number]) -> _Number: ...
if sys.version_info >= (3, 6):
def harmonic_mean(data: Iterable[_Number]) -> _Number: ...
def median(data: Iterable[_Number]) -> _Number: ...
def median_low(data: Iterable[_Number]) -> _Number: ...
def median_high(data: Iterable[_Number]) -> _Number: ...
def median_grouped(data: Iterable[_Number]) -> _Number: ...
def mode(data: Iterable[_Number]) -> _Number: ...
if sys.version_info >= (3, 8):
def multimode(data: Iterable[_T]) -> List[_T]: ...
def pstdev(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
def pvariance(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
if sys.version_info >= (3, 8):
def quantiles(data: Iterable[_Number], *, n: int = ..., method: str = ...) -> List[_Number]: ...
def stdev(data: Iterable[_Number], xbar: Optional[_Number] = ...) -> _Number: ...
def variance(data: Iterable[_Number], xbar: Optional[_Number] = ...) -> _Number: ...
if sys.version_info >= (3, 8):
class NormalDist:
def __init__(self, mu: float = ..., sigma: float = ...) -> None: ...
@property
def mean(self) -> float: ...
@property
def median(self) -> float: ...
@property
def mode(self) -> float: ...
@property
def stdev(self) -> float: ...
@property
def variance(self) -> float: ...
@classmethod
def from_samples(cls: Type[_T], data: Iterable[SupportsFloat]) -> _T: ...
def samples(self, n: int, *, seed: Optional[Any]) -> List[float]: ...
def pdf(self, x: float) -> float: ...
def cdf(self, x: float) -> float: ...
def inv_cdf(self, p: float) -> float: ...
def overlap(self, other: NormalDist) -> float: ...
def quantiles(self, n: int = ...) -> List[float]: ...
def __add__(self, x2: Union[float, NormalDist]) -> NormalDist: ...
def __sub__(self, x2: Union[float, NormalDist]) -> NormalDist: ...
def __mul__(self, x2: float) -> NormalDist: ...
def __truediv__(self, x2: float) -> NormalDist: ...
def __pos__(self) -> NormalDist: ...
def __neg__(self) -> NormalDist: ...
__radd__ = __add__
def __rsub__(self, x2: Union[float, NormalDist]) -> NormalDist: ...
__rmul__ = __mul__
def __hash__(self) -> int: ...