BaşlayınÜcretsiz Başlayın

Choosing clusters

As a US counselor, you understand that humans are social beings and depend on each other. As part of a study you're conducting, you conduct a social relationship survey to explore how people manage their relationships as well as their mental health.

The dataset, mh_survey, includes the gender of the respondent, the US state they live in,US_state_live, and whether they have sought treatment for their mental health to sort through their different relationship dynamics, sought_treatment.

Pandas and numpy as been uploaded as pd and np.

Bu egzersiz

Analyzing Survey Data in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a list of the unique states present in the survey.
  • Randomly choose 10 clusters from the cluster of 47 states that our respondents live in, under column US_state_live.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a list of the unique states present in the survey
unique_states = ____(____(____))

# Randomly choose ten states
random_clusters = ____(unique_states, size = ____, replace = False)

print(random_clusters)
Kodu Düzenle ve Çalıştır