scipy.stats.mstats.ks_1samp(x, cdf, args=(), alternative='two-sided', mode='auto')[source]

Computes the Kolmogorov-Smirnov test on one sample of masked values.

Missing values in x are discarded.


a 1-D array of observations of random variables.

cdfstr or callable

If a string, it should be the name of a distribution in scipy.stats. If a callable, that callable is used to calculate the cdf.

argstuple, sequence, optional

Distribution parameters, used if cdf is a string.

alternative{‘two-sided’, ‘less’, ‘greater’}, optional

Indicates the alternative hypothesis. Default is ‘two-sided’.

mode{‘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


Value of the Kolmogorov Smirnov test


Corresponding p-value.