K-means assigns each observation to a nearby center, then updates the centers to reduce squared distances within the groups. You choose the number of clusters before fitting. The method does not use an outcome label, and the cluster numbers are names rather than a ranking. Cluster 2 is not inherently better than cluster 0.
Scale features when their units would otherwise dominate the distance calculation. These fictional customer records contain visit counts and basket values with deliberately separated groups. The tasks ask for both scaled and unscaled experiments so you can follow an explicit preparation contract. A random_state and several initializations make the fit repeatable. Correctness depends on the partition, not a particular numbering, and a per-customer label array must preserve the original row order.