Skip to main content

Posts

Showing posts from December, 2019

nba_analysis_with_pandas(Source:RealPython)

exploring_with_pandas_real_python_example Downloading data from web ¶ use requests module response object = request.get(url) response.raise_for_status() - will check if request is success or not download it to a file and write response content to it with open ( target_csv_path , "wb" ) as f : f . write ( response . content ) In [6]: import requests download_url = "https://raw.githubusercontent.com/fivethirtyeight/data/master/nba-elo/nbaallelo.csv" target_csv_path = "nba_all_elo.csv" response = requests . get ( download_url ) response . raise_for_status () # check the request was succesful with open ( target_csv_path , "wb" ) as f : f . write ( response . content ) print ( "Download ready" ) Download ready Reading csv file using pandas ¶ In [7]: import pandas ...