This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / stats / _mstats_basic / ks_2samp

function

scipy.stats._mstats_basic:ks_2samp

source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_mstats_basic.py:1970

Signature

def ks_2samp(data1, data2, alternative = two-sided, method = auto)

Summary

Computes the Kolmogorov-Smirnov test on two samples.

Extended Summary

Missing values in x and/or y are discarded.

Parameters

data1 : array_like

First data set

data2 : array_like

Second data set

alternative : {'two-sided', 'less', 'greater'}, optional

Indicates the alternative hypothesis. Default is 'two-sided'.

method : {'auto', 'exact', 'asymp'}, optional

Defines the method used for calculating the p-value. The following options are available (default is 'auto'):

  • 'auto'use 'exact' for small size arrays, 'asymp' for large

  • 'exact'use approximation to exact distribution of test statistic

  • 'asymp'use asymptotic distribution of test statistic

Returns

d : float

Value of the Kolmogorov Smirnov test

p : float

Corresponding p-value.

Aliases

  • scipy.stats._mstats_basic.ks_2samp