Plotting chicken locations
Now you will create a scatterplot that shows where the Nashville chickens are!
Cet exercice fait partie du cours
Visualizing Geospatial Data in Python
Instructions
- The path to the chicken dataset is in the variable
chickens_path
. Use theread_csv
function of pandas to load it into a DataFrame calledchickens
. - Use the
.head()
function to look at the first few rows. - Next add the x and y arguments to
plt.scatter()
to plot the locations of the Nashville chickens. Use the default marker and color options. - Show the plot using
plt.show()
.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Import pandas and matplotlib.pyplot using their customary aliases
import pandas as pd
import matplotlib.pyplot as plt
# Load the dataset
chickens = pd.____(chickens_path)
# Look at the first few rows of the chickens DataFrame
print(chickens.____())
# Plot the locations of all Nashville chicken permits
plt.scatter(x = chickens.____, y = chickens.____)
# Show the plot
plt.show()