Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## here is the answer to problem 2 in '2 lines'
- csvFile = pd.read_csv('RollingStoneAlbumList.csv')
- csvFile["Genre"]= csvFile["Genre"].str.split(",", n = 1, expand = True) #source: https://www.geeksforgeeks.org/python-pandas-split-strings-into-two-list-columns-using-str-split/
- csvFile.groupby("Genre").count().sort_values('Number',ascending=False)[['Number']]
- ## here it is without the method we haven't learned yet in only '1' line
- csvFile = pd.read_csv('RollingStoneAlbumList.csv')
- csvFile.groupby("Genre").count().sort_values('Number',ascending=False)[['Number']]
- #however, this is not the full solution as it does not sort by primary genre
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement