Steps involved

Let's look at the process of creating the line chart:

  1. 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.
  2. Import the matplotlib library. It can be done with this command:
import matplotlib.pyplot as plt
  1. Plot the graph:
plt.plot(df)
  1. Display 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/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.180.43