Avocado supply and demand
Scatter plots are ideal for visualizing relationships between numerical variables. In this exercise, you'll compare the number of avocados sold to average price and see if they're at all related. If they're related, you may be able to use one number to predict the other.
matplotlib.pyplot
has been imported as plt
, pandas
has been imported as pd
, and avocados
is available.
This exercise is part of the course
Data Manipulation with pandas
Exercise instructions
- Create a scatter plot with
nb_sold
on the x-axis andavg_price
on the y-axis. Title it"Number of avocados sold vs. average price"
. - Show the plot.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Scatter plot of avg_price vs. nb_sold with title
____.____
# Show the plot
____