IniziaInizia gratis

Cluster sampling analysis

You and a group of psychologists are interested in analyzing employee mental health. Your research includes a survey that aims to measure attitudes towards mental health in the tech workplace, and examine the frequency of mental health conditions among tech workers.

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 through their employer, sought_treatment.

You will create a pie chart to analyze the likelihood of a tech worker seeking treatment regarding their mental health in the US, sought_treatment. A random list of 10 state clusters, random_cluster, has bee uploaded for you.

Pandas and numpy as been uploaded as pd and np.

Questo esercizio fa parte del corso

Analyzing Survey Data in Python

Visualizza il corso

Istruzioni dell'esercizio

  • Subset dataset to include only states in random_clusters.
  • Create a pie chart of the sought_treatment column.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Subset dataset to inlude only states in cluster_sample
cluster_sample = ____[mh_survey.US_state_live.____(____)]

# Create a pie chart of the sought_treament column
treatment_pie = cluster_sample.____.____(normalize=True)
treatment_pie.____.____()
plt.show()
Modifica ed esegui il codice