Comments (13)
Fixed... Apparently there's been a change in Pandas, at least for version 0.25.0 (the requirements.txt file for fma doesn't specify a version for pandas).
So the fix is to modify utils.py so that it includes
from pandas.api.types import CategoricalDtype
and the offending line about categories that used to read as
'category', categories=SUBSETS, ordered=True)
now reads as
CategoricalDtype(categories=SUBSETS, ordered=True))
. :-)
from fma.
What does:
import pandas
print(pandas.__version__)
prints?
from fma.
This error also appears in the creation notebook
from fma.
Thanks for reporting! This behavior was indeed removed in pandas 0.25:
Removed the previously deprecated
ordered
andcategories
keyword arguments inastype
(GH17742)
I used pandas==0.21.0
when developing this code. I will add package versions to the requirements.txt
.
from fma.
Hi, I tried to use the new code but the error persist in the next line.
Thanks for your work.
TypeError Traceback (most recent call last)
<ipython-input-31-4224f39de5bf> in <module>()
1 AUDIO_DIR = os.environ.get('fma_small')
----> 2 tracks = utils.load('fma_metadata/tracks.csv')
/content/utils.py in load(filepath)
212 tracks[column] = tracks[column].astype('category')
213
--> 214 return tracks
215
216
TypeError: astype() got an unexpected keyword argument 'categories'
from fma.
Thanks, I didn't realized that my pandas version was downgraded.
from fma.
I tried to use the new code but the error persist in the next line.
The line number of the error (--> 214 return tracks
) seems to indicate you're not using the latest version. The latest has a try-catch block for this case:
212 try:
213 tracks['set', 'subset'] = tracks['set', 'subset'].astype(
214 'category', categories=SUBSETS, ordered=True)
215 except ValueError:
216 # the categories and ordered arguments were removed in pandas 0.25
217 tracks['set', 'subset'] = tracks['set', 'subset'].astype(
218 pd.CategoricalDtype(categories=SUBSETS, ordered=True))
So both old (pandas<0.25
) and new (pandas>=0.25
) pandas should work.
Could you try a fresh git clone
?
from fma.
Hello, I know I'm a little late, but I would like to add that I am still getting the error despite the try-catch block.
Edit: I fixed it by removing the except ValueError: and just changing it to except:
from fma.
Thanks for reporting @albert239825. Which exception did you get? If TypeError
, could you try #47? Which version of pandas (import pandas; print(pandas.__version__)
) are you using?
from fma.
@mdeff I didn't get a type error. My pandas version is 1.2.2 and the error I get is "astype() got an unexpected keyword argument 'categories'".
Edit: Also, I undid a commit with the fix and now it's broken again...
Edit: Nevermind, changing
except ValueError:
to except:
fixed the issue as before
from fma.
the error I get is "astype() got an unexpected keyword argument 'categories'"
And that's a TypeError
. 😉
Hence I'll merge #47.
from fma.
@mdeff Thanks! So sorry for my lack of knowledge.
from fma.
No problem. 😉 Thank you for following-up on the issue.
from fma.
Related Issues (20)
- Corrupted Files? HOT 6
- 'Categories' Type error
- How to find the title metadata of a particular file in fma_large? HOT 3
- Corrupted files in FMA Large HOT 9
- Musical key HOT 2
- Image data of album covers HOT 6
- Uncompressed Version Of Audio HOT 1
- Selecting Subset of Multiple Genres HOT 2
- Download only subset of zip file HOT 1
- Lossless music format HOT 2
- Errors in the FMA_large.zip and FMA_full.zip HOT 6
- Where I can find *.csv files? HOT 1
- Musik
- music genre category challenge list HOT 1
- zip can not uncompress HOT 2
- Get metadata by track_id?
- Understanding Column Labels (01, 02, 03, etc.) in FMA Dataset HOT 1
- Baseline performances for "Single top genre on the balanced small subset"
- Corrupted files in fma_small HOT 2
- Pytorch dataloader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fma.