Case 3 – reading data from a URL
Several times, we need to read the data directly from a web URL. This URL might contain the data written in it or might contain a file which has the data. For example, navigate to this website, http://winterolympicsmedals.com/ which lists the medals won by various countries in different sports during the Winter Olympics. Now type the following address in the URL address bar: http://winterolympicsmedals.com/medals.csv.
A CSV file will be downloaded automatically. If you choose to download it manually, saving it and then specifying the directory path for the read_csv
method is a time consuming process. Instead, Python allows us to read such files directly from the URL. Apart from the significant saving in time, it ...
Get Python: Data Analytics and Visualization 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.