ComenzarEmpieza gratis

Your first plot!

Let's take everything you have learned so far and plot your first time series plot. You will set the groundwork by producing a time series plot of your data and labeling the axes of your plot, as this makes the plot more readable and interpretable for the intended audience.

matplotlib is the most widely used plotting library in Python, and would be the most appropriate tool for this job. Fortunately for us, the pandas library has implemented a .plot() method on Series and DataFrame objects that is a wrapper around matplotlib.pyplot.plot(), which makes it easier to produce plots.

Este ejercicio forma parte del curso

Visualizing Time Series Data in Python

Ver curso

Instrucciones del ejercicio

  • Set the 'date' column as the index of your DataFrame.
  • Using the discoveries DataFrame, plot the time series in your DataFrame using a "blue" line plot and assign it to ax.
  • Specify the x-axis label on your plot: 'Date'.
  • Specify the y-axis label on your plot: 'Number of great discoveries'.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Set the date column as the index of your DataFrame discoveries
discoveries = ____

# Plot the time series in your DataFrame
ax = discoveries.____(____=____)

# Specify the x-axis label in your plot
____('Date')

# Specify the y-axis label in your plot
____('Number of great discoveries')

# Show plot
plt.show()
Editar y ejecutar código