I am using an API to get some data. The data returned is in Unicode (not a dictionary / json object).
# get data
data = []
for urls in api_call_list:
data.append(requests.get(urls))
the data looks like this:
>>> data[0].text
u'Country;Celebrity;Song Volume;CPP;Index\r\nus;Taylor Swift;33100;0.83;0.20\r\n'
>>> data[1].text
u'Country;Celebrity;Song Volume;CPP;Index\r\nus;Rihanna;28100;0.76;0.33\r\n'
I want to put this in a DataFrame
with Country, Celebrity, Song, Volume, CPP and Index as column names.
First I tried to split it on \r\n
like this:
x = [i.text.split('\r\n') for i in data]
and got:
[[u'Country;Celebrity;Song Volume;CPP;Index',
u'us;Taylor Swift;33100;0.83;0.20',
u''],
[u'Country;Celebrity;Song Volume;CPP;Index',
u'us;Rihanna;28100;0.76;0.33',
u'']]
Not sure where to go from here . . .