Created
December 13, 2016 17:29
-
-
Save Ziggoto/4753befe95d5c4e9e6e278b00fd5faac to your computer and use it in GitHub Desktop.
Testando o Pandas (biblioteca de Data Analysis para Python). Dados retirados do meu próprio perfil do Last.fm. Dia da coleta: 13/12/2016
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
artist = open('top_artists.csv') | |
csv = [(line[0], int(line[1].replace('.', ''))) for line in re.findall(r"\d+\s(.+?)\s([\d\.]+)$", artist.read(), re.MULTILINE)] | |
df = pd.DataFrame(csv, columns=['artist', 'scrobbles']) | |
# print df | |
df.plot.pie(subplots=True, labels=df['artist'], figsize=(30, 30)) | |
plt.show() |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 Zebrahead 4.022 | |
2 Green Day 1.909 | |
3 NOFX 1.787 | |
4 Rancid 1.758 | |
5 The Offspring 1.644 | |
6 Sum 41 1.590 | |
7 Bad Religion 1.533 | |
8 Rise Against 1.363 | |
9 Millencolin 1.203 | |
10 Pennywise 1.189 | |
11 blink-182 1.122 | |
12 Goldfinger 1.061 | |
13 Queen 1.058 | |
14 Red Hot Chili Peppers 1.013 | |
15 Foo Fighters 959 | |
16 A Day to Remember 949 | |
17 Sonata Arctica 879 | |
18 Airbourne 878 | |
19 Five Finger Death Punch 866 | |
20 CPM 22 850 | |
21 U2 785 | |
22 Less Than Jake 711 | |
23 AC/DC 681 | |
24 Iron Maiden 672 | |
25 The Strokes 612 | |
26 Limp Bizkit 579 | |
27 Avenged Sevenfold 521 | |
28 Slipknot 479 | |
29 Lynyrd Skynyrd 469 | |
30 Matanza 465 | |
31 System of a Down 462 | |
32 Social Distortion 408 | |
33 Dropkick Murphys 402 | |
34 Linkin Park 378 | |
35 Andrew W.K. 365 | |
36 Jimi Hendrix 353 | |
37 The F-Ups 331 | |
38 Gorillaz 328 | |
39 Skindred 301 | |
40 Paddy and the Rats 299 | |
41 Hellions 270 | |
42 The Killers 255 | |
43 Metallica 251 | |
44 Papa Roach 242 | |
45 Pink Floyd 237 | |
46 Pearl Jam 232 | |
47 Bring Me the Horizon 230 | |
48 Detonautas Roque Clube 213 | |
49 Korn 212 | |
50 Rage Against the Machine 209 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment