首页 > 解决方案 > Advices on what kind of structure to use in Python to store music informations

问题描述

I'm working on a Music project, and I'm retrieving informations about artists, but I don't know what shoul be the best structure to use to store the data. I was thinking about a simple DataFrame, but I want to insert informations like number of albums, and for everyone of them, other infos like number of song, genre, year, lyrics of the songs and so on...

My last idea was to work with json, and that's the proposal:

jsondic = {
        'artist': 'name',
        'genre': 'rock',
        'link': 'linksite',
        'year': 0000,
        'n_album': 10,
        'album': {
            'title': 'titalbum',
            'release': 'releaseyear',
            'tracks': {
                'id': 1,
                'title': 'songtitle',
                'lyrics':'boby content of songs'
            }
        }
    }

is that a good idea? can you suggest better ways? maybe faster also in terms of computation capacity, because I estimate to store 10,000 artists (with all the songs and the lyrics)

thank you!

标签: pythonjsonpandas

解决方案


  1. Looks good at the first glance.
  2. Add code to populate the structure. (this will enable us to test it)
  3. Add one code to print the structure.
  4. 10000 is not (assuming you are not string musics). Repeat one single example 10000 times to get initial of perfo? 5.Mobile or desktop app?

推荐阅读