Outputs you create
answer- The requested result, with the values, labels and row order described by this task.
length | width | species |
|---|---|---|
| 1 | 2 | A |
| 2 | 1 | B |
| 4 | 4 | A |
| 5 | 3 | B |
- Select measurements only into
answer. - Leave
speciesout of both fitting and choice of group count; an external comparison comes after the grouping is fixed.
answerHints
Think: Fitting omitted species, but selection of k still used that reference label. Select a grouping from measurement geometry, profiles and exploratory purpose before inspecting species. A later descriptive comparison with species can inform interpretation without becoming the fitting or selection objective.
Tools: K-Means retrieval: use the supplied length, width, species columns and the pandas or model operations introduced in this lesson.
Approach: Compute answer from the supplied evidence. Preserve the requested labels and row order, then inspect the values before checking.
Explained solution
answer = df[['length','width']].copy()
print(answer)
Fitting omitted species, but selection of k still used that reference label. Select a grouping from measurement geometry, profiles and exploratory purpose before inspecting species. A later descriptive comparison with species can inform interpretation without becoming the fitting or selection objective.