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 / count_tied_groups

function

scipy.stats._mstats_basic:count_tied_groups

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

Signature

def count_tied_groups(x, use_missing = False)

Summary

Counts the number of tied values.

Parameters

x : sequence

Sequence of data on which to counts the ties

use_missing : bool, optional

Whether to consider missing values as tied.

Returns

count_tied_groups : dict

Returns a dictionary (nb of ties: nb of groups).

Examples

from scipy.stats import mstats
import numpy as np
z = [0, 0, 0, 2, 2, 2, 3, 3, 4, 5, 6]
✓
mstats.count_tied_groups(z)
✗
{np.int64(2): 1, np.int64(3): np.int64(2)}
In the above example, the ties were 0 (3x), 2 (3x) and 3 (2x).
z = np.ma.array([0, 0, 1, 2, 2, 2, 3, 3, 4, 5, 6])
✓
mstats.count_tied_groups(z)
✗
{np.int64(2): np.int64(2), np.int64(3): 1}
z[[1,-1]] = np.ma.masked
✓
mstats.count_tied_groups(z, use_missing=True)
✗
{np.int64(2): 2, np.int64(3): 1}

Aliases

  • scipy.stats._mstats_basic.count_tied_groups