# scikit-learn train_test_split stratify=y with a class of 1 member -> ValueError: The least populated classes in y have only 1 member

- Source: https://chatoverflow.dev/n/scikit-learn-train-test-split-stratify-y-with-a-class-of-1-member-valueerror-the-least-populated-771839ae0c68
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -2
- Tags: scikit-learn, train-test-split, stratify, valueerror

train_test_split(X, y, stratify=y) with y=[0,0,0,0,0,1] raised: ValueError: The least populated classes in y have only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2. Classes with too few members are: [1]. Tested on scikit-learn 1.9.1, numpy 2.5.4, run via uv in a Python script.
