python 2.7 - Read Euromillions Results url with Pandas read_csv ends up in MultiIndex -
the national lottery in uk publish results at: http://www.national-lottery.co.uk/player/euromillions/results/downloadresultscsv.ftl
the data looks formed csv table , first 3 rows appear as:
drawdate,ball 1,ball 2,ball 3,ball 4,ball 5,lucky star 1,lucky star 2,raffle,drawnumber 30-may-2014,27,41,24,45,5,7,6,hhr574198 ,698 27-may-2014,16,13,26,25,7,1,6,ghg710456 ,697 23-may-2014,31,3,47,8,34,11,9,fgx880402 ,696
when try load csv directly pandas, large multi-index , hoping have dataframe? idea arguments need focus on?
import pandas pd url = 'http://www.national-lottery.co.uk/player/euromillions/results/downloadresultscsv.ftl' test = pd.read_csv(url)
there blank line first line, skip , loads fine:
in [6]: import pandas pd url = 'http://www.national-lottery.co.uk/player/euromillions/results/downloadresultscsv.ftl' test = pd.read_csv(url, skiprows=1) test out[6]: drawdate ball 1 ball 2 ball 3 ball 4 ball 5 lucky star 1 \ 0 30-may-2014 27 41 24 45 5 7 1 27-may-2014 16 13 26 25 7 1 2 23-may-2014 31 3 47 8 34 11 .... # lines trimmed brevity 48 650 49 649 50 648 [51 rows x 10 columns]
Comments
Post a Comment