CommencerCommencer gratuitement

Minimum wage by region

Looking at summary statistics of grouped data is a great way to learn about potential differences and similarities between the groups. Combine it with the @chain macro and you have nicely readable code!

In this exercise, you'll revisit the US minimum wage trends. As the 50 states plus Washington, D.C., is too much, you will look at the four regions of the United States - Northeast, Midwest, South, and West. The dataset has been loaded as wages.

Let's see how the different regions handle the minimum wage!

DataFrames, Statistics, Chain, and Plots packages have been loaded for you with the using keyword.

Cet exercice fait partie du cours

Data Manipulation in Julia

Afficher le cours

Instructions

  • Create a chain macro on the wages DataFrame and save the result as regions_wage.
  • Inside the macro, group by region and year columns.
  • Calculate the median of effective_min_wage_2020_dollars and name the column median_effective_wage_2020.
  • Unstack the result so that the rows correspond to years, columns to regions, and values to the median wage.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Create the chain macro
regions_wage = ____

	# Group by region and year
    groupby(____)

	# Calculate the median wage per region per year
    combine(____)

	# Reshape the result
    ____
end

make_plot(regions_wage)
Modifier et exécuter le code