I have downloaded a CSV file from Google Trends which presents data in this format:
Top cities for golden globes
City,golden globes
New York (United States),100
Los Angeles (United States),91
Toronto (Canada),69
Top regions for golden globes
Region,golden globes
United States,100
Canada,91
Ireland,72
Australia,72
There are 3-4 of these groups separated by whitespace. The first line of each group contains text I want to use as a key, followed by a list of dictionaries I need associated with that key. Does anyone have any advice on some Python tools I could use to make this happen? I'm not having much luck with Python's CSV library.
My desired output from the above CSV would look like this:
{
"Top cities for golden globes" :
{
"New York (United States)" : 100,
"Los Angeles (United States)" : 91,
"Toronto (Canada)" : 69
},
"Top regions for golden globes" :
{
"United States" : 100,
"Canada" : 91,
"Ireland" : 72,
"Australia" : 72
}
}