LoslegenKostenlos loslegen

Group clusters

An ongoing 2016 survey aims to measure attitudes towards mental health in the tech workplace, and examine the frequency of mental health conditions among tech workers. This is an online survey for participants in the tech industry.

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.

pandas and matplotlib.pylot has been uploaded for you as pd and plt, respectively.

Diese Übung ist Teil des Kurses

Analyzing Survey Data in Python

Kurs anzeigen

Anleitung zur Übung

  • Group the population into clusters of US_state_live and calculate the number of respondents.
  • Plot a bar graph of the number of respondents by US_state_live.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Group population into clusters and calculate respondents
groups = mh_survey.____(____)[____].____.reset_index()
groups.columns = ['US_state_live','count']

# Plot a bar graph of number of respondents by US_state_live
groups.____.____(____,y='count')
plt.show()
Code bearbeiten und ausführen