W3cubDocs

/scikit-learn

check_consistent_length

sklearn.utils.check_consistent_length(*arrays)[source]

Check that all arrays have consistent first dimensions.

Checks whether all objects in arrays have the same shape or length.

Parameters:
*arrayslist or tuple of input objects.

Objects that will be checked for consistent length.

Examples

>>> from sklearn.utils.validation import check_consistent_length
>>> a = [1, 2, 3]
>>> b = [2, 3, 4]
>>> check_consistent_length(a, b)

© 2007–2025 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/1.6/modules/generated/sklearn.utils.check_consistent_length.html