ComenzarEmpieza gratis

Plotting chicken locations

Now you will create a scatterplot that shows where the Nashville chickens are!

Este ejercicio forma parte del curso

Visualizing Geospatial Data in Python

Ver curso

Instrucciones del ejercicio

  • The path to the chicken dataset is in the variable chickens_path. Use the read_csv function of pandas to load it into a DataFrame called chickens.
  • 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().

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# 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()
Editar y ejecutar código