Accessing data on the web and in the cloud

It is quite common to read data off the web and from the cloud. pandas makes it extremely easy to read data from the web and cloud. All of the pandas functions we have examined can also be given an HTTP URL, FTP address, or S3 address instead of a local file path, and all work just the same as they work with a local file.

The following demonstrates how easy it is to directly make HTTP requests using the existing pd.read_csv() function. The following retrieves the daily stock data for Microsoft in June 2014 directly from the Yahoo! Finance web service via its HTTP query string model:

In [32]:
   # read csv directly from Yahoo! Finance from a URL
 df = pd.read_csv("http://ichart.yahoo.com/table.csv?s=MSFT&" ...

Get Learning pandas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.