mdeff / fma

FMA: A Dataset For Music Analysis

Home Page:https://arxiv.org/abs/1612.01840

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error loading tracks; Discrepancy between column "genre/s_top" in util.py, tracks.csv and usage.ipynb

victoreram opened this issue · comments

In line 201 in utils.py, one of the columns being called is
('track', 'genres_top')
but shouldn't it be
('track', 'genre_top')
based on tracks.csv?

However when I make that change, I get the following error:

ValueError                                Traceback (most recent call last)
<ipython-input-5-eecca7133c46> in <module>()
----> 1 tracks = utils.load('fma_metadata/tracks.csv')
      2 genres = utils.load('fma_metadata/genres.csv')
      3 features = utils.load('fma_metadata/features.csv')
      4 echonest = utils.load('fma_metadata/echonest.csv')
      5 

~\OneDrive\Documents\GitHub\fma\utils.py in load(filepath)
    201                    ('track', 'genre_top')]
    202         for column in COLUMNS:
--> 203             tracks[column] = tracks[column].map(ast.literal_eval)
    204 
    205         COLUMNS = [('track', 'date_created'), ('track', 'date_recorded'),

C:\Anaconda3\lib\site-packages\pandas\core\series.py in map(self, arg, na_action)
   2052                                      index=self.index).__finalize__(self)
   2053         else:
-> 2054             mapped = map_f(values, arg)
   2055             return self._constructor(mapped,
   2056                                      index=self.index).__finalize__(self)

pandas\src\inference.pyx in pandas.lib.map_infer (pandas\lib.c:62578)()

C:\Anaconda3\lib\ast.py in literal_eval(node_or_string)
     82                 return left - right
     83         raise ValueError('malformed node or string: ' + repr(node))
---> 84     return _convert(node_or_string)
     85 
     86 

C:\Anaconda3\lib\ast.py in _convert(node)
     81             else:
     82                 return left - right
---> 83         raise ValueError('malformed node or string: ' + repr(node))
     84     return _convert(node_or_string)
     85 

ValueError: malformed node or string: <_ast.BinOp object at 0x00000253FB0C02B0>

I can load in the features, echonest, and genres with no errors.

Please see the Usage section in the README and do git checkout rc1. That's a duplicate of #9.

Thank you for the response. I followed that, but now I'm getting a similar error:

ValueError                                Traceback (most recent call last)
<ipython-input-1-e0b9f0f91162> in <module>()
      1 import utils
----> 2 tracks = utils.load('C:\\Users\\ramir\\OneDrive\\Documents\\GitHub\\fma_metadata\\tracks.csv')
      3 tracks.shape

~\OneDrive\Documents\GitHub\fma\utils.py in load(filepath)
    200                    ('track', 'genres'), ('track', 'genres_all')]
    201         for column in COLUMNS:
--> 202             tracks[column] = tracks[column].map(ast.literal_eval)
    203 
    204         COLUMNS = [('track', 'date_created'), ('track', 'date_recorded'),

C:\Anaconda3\lib\site-packages\pandas\core\series.py in map(self, arg, na_action)
   2052                                      index=self.index).__finalize__(self)
   2053         else:
-> 2054             mapped = map_f(values, arg)
   2055             return self._constructor(mapped,
   2056                                      index=self.index).__finalize__(self)

pandas\src\inference.pyx in pandas.lib.map_infer (pandas\lib.c:62578)()

C:\Anaconda3\lib\ast.py in literal_eval(node_or_string)
     82                 return left - right
     83         raise ValueError('malformed node or string: ' + repr(node))
---> 84     return _convert(node_or_string)
     85 
     86 

C:\Anaconda3\lib\ast.py in _convert(node)
     81             else:
     82                 return left - right
---> 83         raise ValueError('malformed node or string: ' + repr(node))
     84     return _convert(node_or_string)
     85 

ValueError: malformed node or string: nan

In addition I get the warning:

DtypeWarning: Columns (0,1,5,6,8,12,18,20,21,22,24,33,34,38,39,44,47,48,49,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103) have mixed types. Specify dtype option on import or set low_memory=False.
if self.run_code(code, result):

@mdeff 's git checkout rc1 fixed this for me.

@mdeff is there a version of fma_metadata.zip that can work with master?

@victoreram I can't reproduce. What's your OS, and versions of python, numpy, and pandas?