Exercise

Exploring with box plots

Two common formats of DataFrames are the wide format and long format. The wide format shows different variables represented in different columns, while the long format displays different variables represented by two columns together (one for the variable name and the other for the corresponding values).

Long versions of DataFrames can be useful for easily creating different visualizations, including the boxplot that you will create in this exercise after converting df_diffs (loaded for you) from wide to long format.

pandas has been loaded for you as pd, matplotlib.pyplot as plt, and Seaborn as sns.

Instructions

100 XP
  • Convert the bmi and hdl columns (specified in that order) of the df_diffs DataFrame from wide to long format; save the long DataFrame as hdl_bmi_long and name the column that will contain the variable values y_diff.
  • Use a boxplot to visualize the results of patients in the first or last quartile of the hdl and bmi variables.