0

I have the following code that saves the data from csv file from the web. The code to read from the web is as follow:

country_results = []
for country in ['E0', 'SP1', 'I1', 'D1', 'F1']:
    year_results = []
    for year in range(2005,2006):
        url = "http://www.football-data.co.uk/mmz4281/"+str(year)[-2:]+str(year+1)[-2:]+ "/" + country +".csv"
        print(url)
        year_results = pd.read_csv(url)

        country_results.append(year_results)

when I printed country_results it only has data for E0 of for loop. I want to append all value from for loop such as data from E0,SP1,I1 etc. Another thing is that I want country_results as dataframe. Right now it gave me list. How can I convert list to pandas data frame? I would like to seek advice from experts.

Thanks, Zep

Zephyr
  • 1,312
  • 1
  • 12
  • 24

0 Answers0