lundi 2 novembre 2015

Looping through a JSON file

I have a JSON file with an a bunch of songs and related information (song name, artist name, x value, y value. I want to loop through this file and average the x values and the y values by artist in python. The output would be to a new JSON. I have copied and pasted an a part of the JSON file below.

    "album": "The Dreamer", 
    "name": "Playboys of the Southwestern World", 
    "artist": "Blake Shelton", 
    "y": 0.8600923792922929, 
    "genre": "Country", 
    "x": 0.99999984013557108
}, 
{
    "album": "The Dreamer", 
    "name": "The Baby", 
    "artist": "Blake Shelton", 
    "y": 0.9047390767115189, 
    "genre": "Country", 
    "x": 0.93404072279989159
}, 
{
    "album": "American Saturday Night", 
    "name": "The Pants", 
    "artist": "Brad Paisley", 
    "y": 0.9217607211803096, 
    "genre": "Country", 
    "x": 0.99429577888493459
}, 

Aucun commentaire:

Enregistrer un commentaire