pandas has direct support for various web-based data source classes in the pandas.io.data
namespace. The primary class of interest is pandas.io.data.DataReader
, which is implemented to read data from various supported sources and return it to the application directly as DataFrame
.
Currently, support exists for the following sources via the DataReader
class:
Daily historical prices' stock from either Yahoo! and Google Finance
Yahoo! Options
The Federal Reserve Economic Data library
Kenneth French's Data Library
The World Bank
The specific source of data is specified via the DataReader
object's data_source
parameter. The specific items to be retrieved are specified using the name
parameter. If the data source supports selecting data between a range of dates, these dates can be specified with the start
and end
parameters. We will now take a look at reading data from each of these sources.