
Steps involved
Let's look at the process of creating the line chart:
Load and prepare the dataset. We will learn more about how to prepare data in Chapter 4, Data Transformation. For this exercise, all the data is preprocessed.
Import the matplotlib library. It can be done with this command:
import matplotlib.pyplot as plt
3.lot the graph:
plt.plot(df)
4.isplay it on the screen:
plt.show()
Here is the code if we put it all together:
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (14, 10)
plt.plot(df)
And the plotted graph looks something like this:
In the preceding example, we assume the data is available in the CSV format. In real-life scenarios, the data is mostly available in CSV, JSON, Excel, or XML formats and is mostly disseminated through some standard API. For this series, we assume you are already familiar with pandas and how to read different types of files. If not, it's time to revise pandas. Refer to the pandas documentation for further details: https://pandas-datareader.readthedocs.io/en/latest/.