Inflation in the Car Market (3/8)

Plotting Prices in Callisto Jupyter Notebooks

In the previous parts, we completed the tedious and boilerplate coding portion of our Car Prices project. Now we get to do the best part, plots!

Before plotting, make sure to run the code from Part 2. The consumer-price–index for the used car series should be assigned to a variable called cpi_used_car.

Plotting is super simple, run the following few lines in a new cell

# create a line plot using cpi_used_car series
used_car_plot = sns.relplot(data=cpi_used_car, kind="line")

# set the size and give it a title
used_car_plot.set(title="Consumer Price Index Used Cars")
used_car_plot.fig.set_size_inches(13, 5)

You should see something like this:

There should be a big spike after 2020 (yay inflation!). Depending on when you run this notebook, you should see some decrease after the big jump, especially near the end of 2022 and onwards.

Plotting For the 21st Century

For our economic data exploration, we don’t necessarily care about what happened to car prices more than a few years ago. To get a good historical perspective, the past 20 years are enough to give context.

Run the following code in a new cell to slice and plot the trends for the 21st century:

# get all the values from 2000 onward
cpi_used_car_21st = cpi_used_car[cpi_used_car.index.slice_indexer("2000-01-01")]

# plot and annotate the graph
cpi_used_car_chart_21 = sns.relplot(data=cpi_used_car_21st, kind= "line")
cpi_used_car_chart_21.set(title="Consumer Price Index Used Cars 21st Century")
cpi_used_car_chart_21.fig.set_size_inches(13, 5)

Now the graph should give a better view of the present times with some historical context

That was a lot of work! What’s next?

Figure out why prices increased so much (and automate our plots!)

To get to the bottom of the prices in the car industry we need to chart data for a few other series (like supply and demand and cost of materials). To make it super easy to do, we will automate our graphs. They will practically chart themselves!

Check out the next part to see our plan to automate this process.