Probably type check should be performed. In my case X was `list` and i received > subset_X = X[labels == cluster_id, :] > TypeError: list indices must be integers or slices, not tuple