LoslegenKostenlos loslegen

Upcharging heavier smokers

In this exercise, you will investigate how smoker status and BMI affect the cost of insurance premium charges. You will accomplish this by creating a scatter plot that displays insurance charges against BMI, grouped by smoker status. You will utilize the DataFrame recipe we discussed in the video to achieve this.

The insurance DataFrame has already been loaded for you, providing the necessary data for the analysis. The DataFrames package has been imported.

Diese Übung ist Teil des Kurses

Introduction to Data Visualization with Julia

Kurs anzeigen

Anleitung zur Übung

  • Import the necessary package that defines the DataFrame plotting recipe.
  • Use the recipe to create a scatter plot using data in the insurance DataFrame.
  • Pass the :BMI, :Charges, and :Smoker columns as arguments in the appropriate positions.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Import the necessary package
using ____

# Use recipe
____ ____ ____(
	# Pass columns
	:____,
    :____,
    group=:____,
    legendtitle="Smoker")
xlabel!("Body Mass Index (BMI)")
ylabel!("Insurance Premium (USD)")
Code bearbeiten und ausführen