Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Don't Forget the Songs that Made you Smile

Don't Forget the Songs that Made you Smile

A talk on how to play with Python and setlists coming from setlist.fm API.

Fabio Lamanna

September 23, 2017
Tweet

More Decks by Fabio Lamanna

Other Decks in Programming

Transcript

  1. Bogota Guadalajara Lima Caracas Brussels Lisbon Saint Petersburg Dallas Detroit

    Buenos Aires Seoul Vancouver Rio de Janeiro Sao Paulo Santiago Stockholm Atlanta Manila Phoenix Miami Toronto Rome Amsterdam Istanbul Bandung Barcelona Houston Milan Montreal Moscow Mexico City Osaka London San Francisco Tokyo Los Angeles Manchester New York Paris Philadelphia Nagoya Berlin Jakarta Bangkok Madrid Washington Kuala Lumpur San Diego Singapore Boston Dublin Chicago Sydney Top 3 Cities / Cluster according to Power of Integration 0.79 London 0.54 Manchester 0.52 Los Angeles C1 Pc C2 0.37 Philadelphia 0.34 Paris 0.32 Singapore Pc C3 0.12 Rome 0.12 Miami 0.12 Toronto Pc # Languages Entropy Lamanna F, Lenormand M, Salas-Olmedo MH, Romanillos G, Gonçalves B & Ramasco JJ (2016) 
 Immigrant community integration in world cities arXiv preprint arXiv:1609.03375.
  2. eventID;song;set 53d7f3d9;Kaleid;0 53d7f3d9;World in My Eyes;0 53d7f3d9;Halo;0 53d7f3d9;Shake the Disease;0

    53d7f3d9;Everything Counts;0 53d7f3d9;Master and Servant;0 53d7f3d9;Never Let Me Down Again;0 53d7f3d9;Waiting for the Night;0 53d7f3d9;Here Is the House;0 53d7f3d9;Sweetest Perfection;0 53d7f3d9;Clean;0 53d7f3d9;Stripped;0 53d7f3d9;Policy of Truth;0 53d7f3d9;Enjoy the Silence;0 53d7f3d9;Strangelove;0 53d7f3d9;Personal Jesus;0 53d7f3d9;Black Celebration;1 53d7f3d9;A Question of Time;1 53d7f3d9;Behind the Wheel;2 53d7f3d9;Route 66;2
  3. eventID;song;set 53d7f3d9;Kaleid;0 53d7f3d9;World in My Eyes;0 53d7f3d9;Halo;0 53d7f3d9;Shake the Disease;0

    53d7f3d9;Everything Counts;0 53d7f3d9;Master and Servant;0 53d7f3d9;Never Let Me Down Again;0 53d7f3d9;Waiting for the Night;0 53d7f3d9;Here Is the House;0 53d7f3d9;Sweetest Perfection;0 53d7f3d9;Clean;0 53d7f3d9;Stripped;0 53d7f3d9;Policy of Truth;0 53d7f3d9;Enjoy the Silence;0 53d7f3d9;Strangelove;0 53d7f3d9;Personal Jesus;0 53d7f3d9;Black Celebration;1 53d7f3d9;A Question of Time;1 53d7f3d9;Behind the Wheel;2 53d7f3d9;Route 66;2
  4. Clean,In Your Room,2 Clean,Miles Away/The Truth Is,1 Clean,Never Let Me

    Down Again,76 Clean,Personal Jesus,90 Clean,Policy of Truth,89 Clean,Route 66,88 Clean,Shake the Disease,1 Clean,Strangelove,88 Clean,Stripped,89 Clean,The Bottom Line,1 Clean,When the Body Speaks,1 Come Back,Behind the Wheel,5 Come Back,Dressed in Black,2 Come Back,Enjoy the Silence,36 Come Back,Fragile Tension,1 Come Back,Happy Birthday Fletch,1 Come Back,I Feel You,35 Come Back,In Sympathy,2 Come Back,In Your Room,35 Come Back,Master and Servant,24 Come Back,Never Let Me Down Again,36 Come Back,One Caress,1 Come Back,Peace,21 Come Back,Personal Jesus,35 Come Back,Photographic,1 Come Back,Policy of Truth,30 Come Back,Shake the Disease,1 Come Back,Somebody,3 Come Back,Strangelove,25 Come Back,Stripped,35 Come Back,Waiting for the Night,27 Condemnation,A Question of Lust,63 Condemnation,A Question of Time,58 Condemnation,Barrel of a Gun,61 Condemnation,Behind the Wheel,10 Condemnation,Black Celebration,8 Condemnation,Breathe,1 Condemnation,Clean,4 Condemnation,Death's Door,70 Condemnation,Enjoy the Silence,216 Condemnation,Everything Counts,87 Condemnation,Fly on the Windscreen,79 Condemnation,Freelove,1 Condemnation,Get Right With Me,21 Condemnation,Halo,1
  5. Damaged People Breathe Enjoy the Silence Precious Hole to Feed

    Personal Jesus Should Be Higher Angel Strangelove I Want You Now Fly on the Windscreen In Chains Freelove I Feel You The Dead of Night John the Revelator Condemnation Wrong Goodnight Lovers Rush Heaven World Full of Nothing World in My Eyes A Question of Time Stripped In Your Room Home Miles Away/The Truth Is Master and Servant Route 66 Easy Tiger / Dream On Walking in My Shoes Suffer Well Mercy in You Soothe My Soul Higher Love Black Celebration Behind the Wheel Shake the Disease It's No Good Never Let Me Down Again The Sinner in Me Dream On Useless When the Body Speaks Waiting for the Night A Pain That I'm Used To Judas Just Can't Get Enough Halo Everything Counts Barrel of a Gun I Want It All A Question of Lust Policy of Truth The Sweetest Condition Welcome to My World Only When I Lose Myself Clean Somebody Painkiller Kaleid
  6. Damaged People Breathe Enjoy the Silence s Angel e Fly

    on the Windscreen Freelove The Dead of Night Condemnation Wrong Goodnight Lovers World Full of Nothing World in My Eyes A Question of Time ped Easy Tiger / Dream On Walking in My Shoes Well Black Celebration Behind the Wheel ase e Sinner in Me Dream On Useless When the Body Speaks Waiting for the Night A Pain That I'm Used To Everything Counts Barrel of a Gun A Question of Lust The Sweetest Condition Welcome to My World Clean
  7. In [13]: from py2neo import Graph In [14]: graph =

    Graph() In [15]: from pandas import DataFrame
  8. In [11]: query = """ ...: MATCH p=(:Set)<-[:IN_SET]-(s:Song)-[:PART_OF]->(:Concert)-[:IN]- >(:Location) ...:

    WHERE s.name contains 'Ultraviolet' ...: RETURN p LIMIT 20 ...: """ In [12]: graph.data(query)
  9. In [5]: graph.data(query) Out[5]: [{u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(e991d64)-[:IN]->(fd6d1be)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(a029d5f)-[:IN]->(e5fa8b3)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(fe3a7f3)-[:IN]->(ddf9b43)},

    {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(c37420f)-[:IN]->(f613b34)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(ecd9021)-[:IN]->(ac7ccfe)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(d68c490)-[:IN]->(ad2b199)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(f60ce94)-[:IN]->(d80258d)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(ab854b3)-[:IN]->(ceb2494)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(e05e9a8)-[:IN]->(a204538)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(c94e0d7)-[:IN]->(d3f4541)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(f3b62d3)-[:IN]->(accf116)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(a914a09)-[:IN]->(c5284e4)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(b10e9d9)-[:IN]->(b00636f)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(e19e6a9)-[:IN]->(b8f33b4)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(a534e60)-[:IN]->(bb8bd6d)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(a682e1b)-[:IN]->(c58efc4)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(d22bb01)-[:IN]->(ce63d04)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(b5f4fe9)-[:IN]->(dacead5)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(b48a038)-[:IN]->(e6646ed)}, {u'p': (f327e15)<-[:IN_SET]-(d003ee8)-[:PART_OF]->(d7e390a)-[:IN]->(c7c40b3)}]
  10. In [9]: query = """ ...: MATCH (set:Set)<-[:IN_SET]-(s:Song)-[:PART_OF]->(c:Concert) ...: WHERE

    s.name contains 'Ultraviolet' ...: RETURN s.name, c.id, set.number ...: """ In [10]: DataFrame(graph.data(query)) Out[10]: c.id s.name set.number 0 3bd6f83c Ultraviolet (Light My Way) 5 1 23d6f833 Ultraviolet (Light My Way) 5 2 2bd6f836 Ultraviolet (Light My Way) 5 3 3bd6f834 Ultraviolet (Light My Way) 5 4 33d6f835 Ultraviolet (Light My Way) 5 5 2bd6f832 Ultraviolet (Light My Way) 5 6 3bd6f830 Ultraviolet (Light My Way) 5 7 33d6f831 Ultraviolet (Light My Way) 5 8 2bd6f82a Ultraviolet (Light My Way) 5 9 23d6f82b Ultraviolet (Light My Way) 5 10 33d6f829 Ultraviolet (Light My Way) 5 11 23d6f823 Ultraviolet (Light My Way) 5 12 2bd6f822 Ultraviolet (Light My Way) 5 13 33d6f82d Ultraviolet (Light My Way) 5 14 3bd6f82c Ultraviolet (Light My Way) 5 15 3bd6f820 Ultraviolet (Light My Way) 5 16 23d6f827 Ultraviolet (Light My Way) 5 17 33d6f821 Ultraviolet (Light My Way) 5