pandas-datareader

We can use pandas to not only read data from local CSV or text files but also from various popular remote data sources such as Yahoo Finance, World Bank, and so on. Without any support from pandas, this would have been tedious and we would have to resort to web scraping. This simple and powerful functionality is provided through the pandas-datareader.

It provides us with a direct way of connecting through various data sources from the comfort of the pandas ecosystem without having to delve into the complexity of HTML/JavaScript code where data is enmeshed. These data sources can be accessed by providing the source name and data code. Only a subset of the data can be obtained.

Let's delve deeper and see how we can use it:

  1. Install pandas-datareader through pip using the following command:
pip install pandas-datareader  

You can also install it through conda using the following  set of commands

  1. First, we have to add conda-forge to our channel:
conda config --add channels conda-forge  
  1. After enabling pandas-datareader, it can be installed with the following code:
conda install pandas-datareader  

Now, let's get hands-on with some of the remote data sources and perform various functions provided by the pandas library to get an idea of how it works.

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

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