Datapane will be used create a personal report for this code. Sign up on Datapane to sign in.
token = input('Insert your token after signing in https://datapane.com/home/')
print(token)
!datapane login --server=https://datapane.com/ --token=$token
Here we look at the data that we've collected and begin deciding our marketing strategy.
import os
import everyscrape
import pandas as pd
import visuals as vs
import target_practice as tp
pd.options.display.max_rows = 500 # set the height and number of rows to display for pandas tables
from importlib import reload
tp = reload(tp)
vs = reload(vs)
Our first step is to select a genre we want to target. This is a bit more complicated than it seems. There are several hundred sub-genres from all over the world. We begin with the word-genre frequency by looking at the words that are most common across genres. Key words that stand out such as rock or pop can be used as high level genres. We follow that up with a look at the sub-genre frquency, examining the most popular sub-genres.
*Word-Genre Frequency:* How often do words pop up in genre names, and how popular are the genres cumulatively.
everygenre = pd.read_csv(os.getcwd()+'/data/everygenre.csv')
everygenre = everygenre.drop('Unnamed: 0',1)
descriptor_frequencies, suggested_genres = tp.word_genre_freq(everygenre)
descriptor_frequencies[descriptor_frequencies['Descr'].str.contains('hop')].append(
descriptor_frequencies[descriptor_frequencies['Descr'].str.contains('rap')]).sort_index()
Descr | Freq | PopFreq | |
---|---|---|---|
9 | hiphop | 88 | 4977 |
36 | trap | 31 | 2500 |
57 | deutschrap | 1 | 49 |
76 | rap | 49 | 2924 |
226 | j-rap | 1 | 86 |
373 | hopebeat | 1 | 8 |
456 | chillhop | 1 | 8 |
537 | glitchhop | 1 | 11 |
543 | triphop | 1 | 10 |
690 | khop | 1 | 10 |
839 | nederhop | 1 | 1 |
843 | traprun | 1 | 2 |
*Sub-genre Frequency:* we can use the key words returned above to retrieve a list of the sub-genres we might be interested in and their popularity.
sub_freqs = tp.subgenre_freq(everygenre, ['rap','hiphop'])
sub_freqs
genre | freq | |
---|---|---|
3 | pop rap | 460 |
10 | rap | 335 |
18 | southern hiphop | 282 |
21 | hiphop | 277 |
27 | latin hiphop | 251 |
28 | underground hiphop | 247 |
29 | swedish gangsta rap | 244 |
44 | dutch hiphop | 209 |
46 | uk hiphop | 202 |
47 | gangster rap | 202 |
67 | spanish hiphop | 180 |
74 | brazilian hiphop | 173 |
75 | french hiphop | 172 |
94 | rap conscient | 154 |
103 | uk alternative hiphop | 150 |
105 | german hiphop | 150 |
111 | deep german hiphop | 144 |
112 | german cloud rap | 143 |
114 | belgian hiphop | 140 |
118 | australian hiphop | 139 |
130 | swedish hiphop | 130 |
134 | australian underground hiphop | 128 |
150 | dirty south rap | 117 |
156 | manchester hiphop | 115 |
157 | argentine hiphop | 115 |
170 | italian hiphop | 111 |
173 | rap dominicano | 107 |
177 | cali rap | 104 |
181 | atl hiphop | 102 |
190 | rap napoletano | 98 |
203 | albanian hiphop | 95 |
204 | danish hiphop | 95 |
226 | mexican hiphop | 89 |
241 | canadian hiphop | 86 |
249 | pinoy hiphop | 84 |
258 | italian underground hiphop | 81 |
260 | pinoy alternative rap | 81 |
272 | hamburg hiphop | 75 |
283 | indie pop rap | 71 |
289 | country rap | 69 |
294 | norwegian pop rap | 66 |
310 | turkish hiphop | 63 |
317 | chicago rap | 62 |
323 | west coast rap | 60 |
324 | polish hiphop | 60 |
332 | rap maroc | 59 |
350 | chicano rap | 57 |
352 | desi hiphop | 56 |
353 | norwegian hiphop | 56 |
392 | arabic hiphop | 50 |
399 | hardcore hiphop | 49 |
419 | finnish hiphop | 45 |
432 | miami hiphop | 44 |
450 | rap rock | 39 |
474 | nz hiphop | 35 |
481 | hiphop tuga | 35 |
506 | emo rap | 31 |
524 | thai hiphop | 29 |
531 | nyc rap | 28 |
537 | florida rap | 28 |
539 | conscious hiphop | 28 |
543 | polish underground hiphop | 27 |
544 | memphis hiphop | 27 |
546 | rap chileno | 27 |
570 | dfw rap | 25 |
579 | deep underground hiphop | 25 |
589 | rap cristao | 24 |
593 | rap catalan | 23 |
597 | houston rap | 23 |
600 | philly rap | 22 |
610 | rap conciencia | 22 |
611 | colombian hiphop | 22 |
615 | alabama rap | 22 |
630 | venezuelan hiphop | 21 |
635 | hiphop quebecois | 21 |
649 | malaysian hiphop | 19 |
652 | swiss hiphop | 19 |
666 | christlicher rap | 18 |
672 | dmv rap | 18 |
676 | alternative hiphop | 17 |
690 | nigerian hiphop | 16 |
696 | chinese hiphop | 15 |
736 | bayerischer rap | 13 |
753 | czsk hiphop | 12 |
771 | czech hiphop | 11 |
790 | minnesota hiphop | 10 |
794 | battle rap | 10 |
813 | new orleans rap | 10 |
818 | east coast hiphop | 9 |
835 | russian hiphop | 9 |
847 | indonesian hiphop | 9 |
852 | israeli hiphop | 8 |
866 | balkan hiphop | 8 |
874 | underground rap | 8 |
881 | rap sardegna | 8 |
899 | rap tunisien | 7 |
912 | west australian hiphop | 7 |
923 | bc underground hiphop | 6 |
936 | greek hiphop | 6 |
948 | detroit hiphop | 6 |
956 | romanian hiphop | 6 |
963 | abstract hiphop | 6 |
981 | dirty texas rap | 5 |
997 | south african hiphop | 5 |
1000 | slovak hiphop | 5 |
1006 | rap metal | 5 |
1039 | baltimore hiphop | 4 |
1043 | hungarian hiphop | 4 |
1045 | irish hiphop | 4 |
1046 | bay area hiphop | 4 |
1047 | nc hiphop | 4 |
1078 | san diego rap | 4 |
1102 | christian hiphop | 3 |
1103 | icelandic hiphop | 3 |
1125 | native american hiphop | 3 |
1129 | bulgarian hiphop | 3 |
1134 | rap ivoire | 3 |
1142 | rap cristiano | 3 |
1146 | pittsburgh rap | 3 |
1164 | vietnamese hiphop | 3 |
1177 | ghanaian hiphop | 3 |
1188 | winnipeg hiphop | 2 |
1192 | lithuanian hiphop | 2 |
1232 | austrian hiphop | 2 |
1260 | estonian hiphop | 2 |
1278 | new jersey rap | 2 |
1327 | rap metal espanol | 1 |
1333 | sinhala rap | 1 |
1347 | hong kong hiphop | 1 |
1358 | portland hiphop | 1 |
1361 | old school hiphop | 1 |
1391 | boston hiphop | 1 |
1452 | rap uruguayo | 1 |
1495 | scottish hiphop | 1 |
1536 | ottawa rap | 1 |
1543 | latvian hiphop | 1 |
1547 | milwaukee hiphop | 1 |
Now that we have an idea of what we can look for we select the genres for which we use the cities_by_genres
method from target_practice.py
to identify the most important city-markets for the genres of interest. This method yields a market importance score. This score is meant to reflect the importance of each city relative to one another, not an absolute value of importance. The market_importance
is calculated based on city size and genre popularity. Type help(tp.cities_by_genres)
for a more detailed explanation.
Individual vs. Combined Markets
You may search genres and sub-genres separately or you may search for combined markets. Combined markets are "either or." In other words, a market will be considered relevant (and the market score will increase) if any of the genres or sub-genres submitted are present.
# search rap and hip hop markets combined
rap_hh_data = tp.cities_by_genres(everygenre, rank_exponent=1.2, genre_rank={'rap':10,'hiphop':10})
# search rap markets and hip hop markets separately
rap_data = tp.cities_by_genres(everygenre, rank_exponent=1.2, genre_rank={'rap':10})
hh_data = tp.cities_by_genres(everygenre, rank_exponent=1.2, genre_rank={'hiphop':10})
rap_data.head(5)
city | country | lat | lng | rank | country code | genre | top_genres | scale_rank | market_importance | |
---|---|---|---|---|---|---|---|---|---|---|
550 | orlando florida | united states | 25.4418 | -80.4685 | 67.0 | US | dirty south rap, pop rap, rap, florida rap, ga... | 29 | 0.972854 | 28.212764 |
580 | phoenix arizona | united states | 33.5722 | -112.0891 | 68.0 | US | west coast rap, rap, chicano rap, gangster rap | 28 | 0.972450 | 27.228592 |
306 | houston texas | united states | 29.7868 | -95.3905 | 8.0 | US | houston rap, dirty south rap, gangster rap | 27 | 0.996752 | 26.912308 |
737 | tampa florida | united states | 25.4418 | -80.4685 | 93.0 | US | gangster rap, pop rap, florida rap, rap, dirty... | 27 | 0.962353 | 25.983541 |
43 | atlanta georgia | united states | 33.1136 | -94.1672 | 12.0 | US | dirty south rap, gangster rap, pop rap, rap | 26 | 0.995129 | 25.873351 |
I can be useful, particularly when planning a marketing campaign, to see how your most and least important markets are laid out geographically. We use the draw_genre_markets
from visuals.py
to display the the markets we've selected on a world map. You may graph a individual or combined markets for a single scatter plot. Alternatively, you may submit a list of datasets to plot individual markets separately.
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks
cufflinks.go_offline(connected=True)
init_notebook_mode(connected=True)
# graph the hip hop and rap markets separately.
fig = vs.draw_genre_markets([rap_data, hh_data], names=['Rap','Hip-Hop'])
iplot(fig, filename = 'Rap_HipHop_World.html')
#plot(fig, filename = 'Rap_HipHop_World.html') # show map in separate tab
esr = rap_data[rap_data['country'].isin(['united states','united kingdom','ireland','canada','australia'])].sort_values('market_importance', ascending=False)
esr.to_csv(os.getcwd()+'/data/rap_markets_in_english_speaking_countries.csv')
esr
city | country | lat | lng | rank | country code | genre | top_genres | scale_rank | market_importance | |
---|---|---|---|---|---|---|---|---|---|---|
550 | orlando florida | united states | 25.4418 | -80.4685 | 67.0 | US | dirty south rap, pop rap, rap, florida rap, ga... | 29 | 0.972854 | 28.212764 |
580 | phoenix arizona | united states | 33.5722 | -112.0891 | 68.0 | US | west coast rap, rap, chicano rap, gangster rap | 28 | 0.972450 | 27.228592 |
306 | houston texas | united states | 29.7868 | -95.3905 | 8.0 | US | houston rap, dirty south rap, gangster rap | 27 | 0.996752 | 26.912308 |
737 | tampa florida | united states | 25.4418 | -80.4685 | 93.0 | US | gangster rap, pop rap, florida rap, rap, dirty... | 27 | 0.962353 | 25.983541 |
43 | atlanta georgia | united states | 33.1136 | -94.1672 | 12.0 | US | dirty south rap, gangster rap, pop rap, rap | 26 | 0.995129 | 25.873351 |
317 | indianapolis indiana | united states | 40.6219 | -79.1552 | 105.0 | US | dirty south rap, gangster rap, rap, pop rap | 26 | 0.957513 | 24.895348 |
233 | federal way washington | united states | 38.9047 | -77.0163 | 217.0 | US | gangster rap, cali rap, pop rap, rap | 25 | 0.912538 | 22.813460 |
655 | san francisco california | united states | 37.7562 | -122.4430 | 24.0 | US | gangster rap, cali rap, west coast rap, pop rap | 23 | 0.990262 | 22.776020 |
56 | bakersfield california | united states | 40.0692 | -79.9152 | 418.0 | US | rap, gangster rap, pop rap, cali rap, chicano rap | 27 | 0.832752 | 22.484299 |
633 | sacramento california | united states | 38.5667 | -121.4683 | 87.0 | US | rap, gangster rap, west coast rap, cali rap | 23 | 0.964775 | 22.189823 |
661 | san leandro california | united states | 37.7071 | -122.1601 | 280.0 | US | west coast rap, gangster rap, pop rap, cali ra... | 25 | 0.887400 | 22.185007 |
535 | oakland california | united states | 41.0313 | -74.2408 | 100.0 | US | pop rap, gangster rap, west coast rap, cali rap | 23 | 0.959530 | 22.069180 |
579 | philadelphia pennsylvania | united states | 40.0076 | -75.1340 | 42.0 | US | pop rap, gangster rap, rap, philly rap | 22 | 0.982968 | 21.625307 |
346 | kent washington | united states | 38.9047 | -77.0163 | 276.0 | US | cali rap, rap, pop rap | 24 | 0.888993 | 21.335829 |
658 | san jose california | united states | 37.3018 | -121.8485 | 126.0 | US | cali rap, gangster rap, west coast rap | 22 | 0.949053 | 20.879170 |
733 | tacoma washington | united states | 38.9047 | -77.0163 | 249.0 | US | pop rap, rap, cali rap | 23 | 0.899755 | 20.694370 |
288 | hayward california | united states | 40.0692 | -79.9152 | 373.0 | US | gangster rap, west coast rap, pop rap, rap, ca... | 24 | 0.850508 | 20.412197 |
650 | san antonio texas | united states | 29.4722 | -98.5247 | 53.0 | US | pop rap, houston rap, dirty south rap, gangste... | 20 | 0.978516 | 19.570319 |
481 | montebello california | united states | 40.0692 | -79.9152 | 691.0 | US | gangster rap, rap, pop rap, cali rap | 26 | 0.726412 | 18.886700 |
548 | orange california | united states | 38.2486 | -78.1127 | 486.0 | US | cali rap, pop rap, rap | 22 | 0.806040 | 17.732869 |
572 | pawtucket rhode island | united states | 41.8900 | -71.3933 | 289.0 | US | gangster rap, pop rap, rap | 20 | 0.883819 | 17.676374 |
381 | las vegas nevada | united states | 35.6011 | -105.2206 | 78.0 | US | cali rap, chicano rap | 18 | 0.968409 | 17.431363 |
158 | columbia maryland | united states | 38.7760 | -76.0702 | 247.0 | US | gangster rap, pop rap, rap | 19 | 0.900553 | 17.110512 |
822 | winter garden florida | united states | 28.5421 | -81.5966 | 507.0 | US | rap, dirty south rap, pop rap, gangster rap | 21 | 0.797820 | 16.754212 |
29 | antioch tennessee | united states | 37.9789 | -121.7957 | 346.0 | US | dirty south rap, gangster rap, pop rap, rap | 19 | 0.861192 | 16.362645 |
811 | walnut creek california | united states | 37.9025 | -122.0398 | 670.0 | US | cali rap, pop rap, rap | 22 | 0.734505 | 16.159099 |
180 | daly city california | united states | 35.1578 | -117.8720 | 616.0 | US | cali rap, pop rap, rap | 21 | 0.755383 | 15.863046 |
651 | san bernardino california | united states | 34.1412 | -117.2936 | 817.0 | US | pop rap, rap, cali rap | 22 | 0.678173 | 14.919798 |
252 | fullerton california | united states | 40.0692 | -79.9152 | 648.0 | US | pop rap, rap, cali rap | 20 | 0.742999 | 14.859977 |
720 | stockton california | united states | 37.9766 | -121.3112 | 593.0 | US | pop rap, rap, cali rap | 19 | 0.764305 | 14.521801 |
147 | citrus heights california | united states | 38.6948 | -121.2880 | 946.0 | US | cali rap, pop rap, rap, gangster rap | 23 | 0.629371 | 14.475540 |
210 | elk grove california | united states | 38.4160 | -121.3840 | 698.0 | US | cali rap, rap, pop rap | 20 | 0.723717 | 14.474344 |
715 | staten island new york | united states | 40.6943 | -73.9249 | 654.0 | US | chicago rap, nyc rap, rap, pop rap | 19 | 0.740681 | 14.072931 |
559 | pacoima california | united states | 40.0692 | -79.9152 | 158.0 | US | cali rap, chicano rap | 15 | 0.936186 | 14.042785 |
136 | charlotte north carolina | united states | 35.2890 | -81.5416 | 49.0 | US | pop rap, rap | 14 | 0.980135 | 13.721885 |
460 | memphis tennessee | united states | 35.1047 | -89.9773 | 260.0 | US | pop rap, rap, gangster rap | 15 | 0.895368 | 13.430519 |
818 | whittier california | united states | 40.0692 | -79.9152 | 749.0 | US | cali rap, pop rap, rap | 19 | 0.704138 | 13.378617 |
528 | north hollywood california | united states | 40.0692 | -79.9152 | 278.0 | US | rap, chicano rap, cali rap | 15 | 0.888197 | 13.322948 |
708 | spartanburg south carolina | united states | 35.1124 | -81.2202 | 763.0 | US | rap, gangster rap, pop rap | 19 | 0.698779 | 13.276796 |
145 | chula vista california | united states | 32.6281 | -117.0145 | 576.0 | US | rap, pop rap, cali rap | 17 | 0.770911 | 13.105490 |
600 | rancho cordova california | united states | 38.5739 | -121.2521 | 455.0 | US | pop rap, gangster rap, cali rap, rap | 16 | 0.818199 | 13.091187 |
331 | jersey city new jersey | united states | 40.7161 | -74.0682 | 328.0 | US | pop rap, rap | 15 | 0.868327 | 13.024899 |
827 | worcester massachusetts | united states | 42.2705 | -71.8079 | 427.0 | US | rap, pop rap | 15 | 0.829208 | 12.438121 |
563 | palmdale california | united states | 40.0692 | -79.9152 | 1059.0 | US | cali rap, rap, pop rap | 21 | 0.587134 | 12.329808 |
445 | mansfield texas | united states | 32.5690 | -97.1211 | 466.0 | US | rap, gangster rap, dirty south rap, pop rap | 15 | 0.813881 | 12.208215 |
601 | rancho cucamonga california | united states | 34.1247 | -117.5664 | 324.0 | US | cali rap, rap, gangster rap | 14 | 0.869913 | 12.178788 |
304 | hopkinton massachusetts | united states | 42.3494 | -71.5468 | 609.0 | US | pop rap, rap | 16 | 0.758097 | 12.129548 |
185 | dearborn heights michigan | united states | 42.3164 | -83.2769 | 732.0 | US | pop rap, rap | 17 | 0.710654 | 12.081123 |
99 | brooklyn new york | united states | 40.6943 | -73.9249 | 31.0 | US | nyc rap, chicago rap | 12 | 0.987424 | 11.849093 |
222 | everett massachusetts | united states | 47.9524 | -122.1670 | 536.0 | US | rap, pop rap | 15 | 0.786492 | 11.797373 |
374 | lancaster california | united states | 32.5922 | -96.7737 | 1068.0 | US | rap, pop rap, chicano rap, cali rap | 20 | 0.583791 | 11.675817 |
216 | escondido california | united states | 40.0692 | -79.9152 | 1000.0 | US | cali rap, chicano rap, rap | 19 | 0.609126 | 11.573394 |
253 | fuquay-varina north carolina | united states | 35.5960 | -78.7802 | 933.0 | US | rap, pop rap, gangster rap | 18 | 0.634262 | 11.416708 |
309 | huntington beach california | united states | 33.6960 | -118.0025 | 470.0 | US | rap, cali rap | 14 | 0.812312 | 11.372363 |
450 | marietta georgia | united states | 33.9532 | -84.5421 | 472.0 | US | rap, pop rap | 14 | 0.811527 | 11.361381 |
344 | katy texas | united states | 29.4128 | -94.9658 | 499.0 | US | pop rap, rap | 14 | 0.800949 | 11.213291 |
242 | fort lauderdale florida | united states | 26.1412 | -80.1464 | 352.0 | US | rap, pop rap | 13 | 0.858816 | 11.164605 |
474 | modesto california | united states | 40.0692 | -79.9152 | 876.0 | US | rap, cali rap, pop rap | 17 | 0.655777 | 11.148215 |
586 | pompano beach florida | united states | 26.2428 | -80.1312 | 659.0 | US | rap, pop rap | 15 | 0.738750 | 11.081244 |
515 | newark new jersey | united states | 39.3167 | -74.6066 | 209.0 | US | pop rap, rap dominicano, rap | 12 | 0.915739 | 10.988867 |
826 | woodbridge virginia | united states | 47.5172 | -92.5121 | 1011.0 | US | pop rap, rap, dmv rap | 18 | 0.605016 | 10.890280 |
64 | baton rouge louisiana | united states | 30.4423 | -91.1314 | 561.0 | US | rap, pop rap | 14 | 0.776748 | 10.874468 |
250 | fresno california | united states | 40.0692 | -79.9152 | 410.0 | US | cali rap, rap | 13 | 0.835904 | 10.866751 |
763 | tucson arizona | united states | 32.1546 | -110.8782 | 254.0 | US | rap, pop rap | 12 | 0.897761 | 10.773127 |
202 | east orange new jersey | united states | 40.7651 | -74.2117 | 726.0 | US | pop rap, rap | 15 | 0.712957 | 10.694349 |
327 | jacksonville florida | united states | 30.3322 | -81.6749 | 285.0 | US | rap, pop rap | 12 | 0.885410 | 10.624923 |
728 | sunnyvale california | united states | 40.0692 | -79.9152 | 513.0 | US | rap, cali rap, pop rap | 13 | 0.795474 | 10.341158 |
187 | decatur georgia | united states | 33.2277 | -97.5898 | 910.0 | US | pop rap, gangster rap, rap | 16 | 0.642929 | 10.286863 |
820 | wilmington delaware | united states | 39.7415 | -75.5413 | 805.0 | US | rap, chicago rap, pop rap | 15 | 0.682743 | 10.241143 |
693 | silver spring maryland | united states | 38.7188 | -90.4749 | 176.0 | US | pop rap, rap | 11 | 0.928961 | 10.218566 |
414 | long beach california | united states | 40.5887 | -73.6660 | 393.0 | US | pop rap, cali rap | 12 | 0.842609 | 10.111305 |
558 | oxnard california | united states | 40.0692 | -79.9152 | 838.0 | US | pop rap, cali rap, rap | 15 | 0.670187 | 10.052806 |
676 | santa rosa california | united states | 38.4465 | -122.7060 | 950.0 | US | rap, cali rap | 16 | 0.627868 | 10.045886 |
256 | garland texas | united states | 29.4128 | -94.9658 | 958.0 | US | rap, pop rap, dirty south rap, gangster rap | 16 | 0.624863 | 9.997805 |
141 | chicago illinois | united states | 41.8373 | -87.6861 | 4.0 | US | chicago rap | 10 | 0.998376 | 9.983759 |
513 | new orleans louisiana | united states | 30.0687 | -89.9288 | 251.0 | US | rap, pop rap | 11 | 0.898957 | 9.888530 |
821 | winston-salem north carolina | united states | 36.1029 | -80.2610 | 772.0 | US | rap, pop rap | 14 | 0.695337 | 9.734722 |
462 | mesa arizona | united states | 33.4017 | -111.7181 | 297.0 | US | gangster rap, rap, pop rap | 11 | 0.880637 | 9.687008 |
652 | san diego california | united states | 32.8312 | -117.1226 | 89.0 | US | cali rap | 10 | 0.963968 | 9.639676 |
549 | orange new jersey | united states | 39.3167 | -74.6066 | 677.0 | US | rap, pop rap | 13 | 0.731805 | 9.513467 |
616 | richmond hill | canada | 31.9203 | -81.3124 | 697.0 | CA | pop rap, rap | 13 | 0.724102 | 9.413326 |
487 | moreno valley california | united states | 33.9244 | -117.2045 | 379.0 | US | rap, cali rap | 11 | 0.848137 | 9.329508 |
209 | elizabeth new jersey | united states | 39.3167 | -74.6066 | 387.0 | US | pop rap, rap | 11 | 0.844977 | 9.294750 |
161 | compton california | united states | 40.0692 | -79.9152 | 189.0 | US | cali rap | 10 | 0.923748 | 9.237483 |
232 | fayetteville north carolina | united states | 35.2890 | -81.5416 | 905.0 | US | rap, pop rap | 14 | 0.644816 | 9.027421 |
711 | spring texas | united states | 30.7478 | -98.2392 | 474.0 | US | pop rap, rap | 11 | 0.810743 | 8.918172 |
803 | visalia california | united states | 40.0692 | -79.9152 | 1238.0 | US | rap, cali rap | 17 | 0.521261 | 8.861440 |
384 | lawrenceville georgia | united states | 38.7263 | -87.6874 | 835.0 | US | pop rap, rap | 13 | 0.671327 | 8.727250 |
167 | corona california | united states | 40.0692 | -79.9152 | 323.0 | US | cali rap | 10 | 0.870310 | 8.703102 |
814 | west jordan utah | united states | 40.6024 | -112.0008 | 545.0 | US | indie pop rap, rap, pop rap | 11 | 0.782981 | 8.612796 |
735 | tallahassee florida | united states | 25.4418 | -80.4685 | 716.0 | US | rap, pop rap | 12 | 0.716797 | 8.601559 |
159 | columbia south carolina | united states | 35.1124 | -81.2202 | 365.0 | US | pop rap, rap | 10 | 0.853671 | 8.536714 |
669 | santa ana california | united states | 33.7366 | -117.8819 | 129.0 | US | cali rap, chicano rap | 9 | 0.947846 | 8.530611 |
293 | henderson nevada | united states | 32.1576 | -94.7960 | 751.0 | US | cali rap, rap | 12 | 0.703372 | 8.440461 |
539 | oceanside california | united states | 40.0692 | -79.9152 | 786.0 | US | rap, cali rap | 12 | 0.689989 | 8.279874 |
81 | bloomington california | united states | 40.4757 | -88.9705 | 441.0 | US | cali rap | 10 | 0.823701 | 8.237005 |
265 | greensboro north carolina | united states | 35.2890 | -81.5416 | 658.0 | US | pop rap, rap | 11 | 0.739136 | 8.130493 |
416 | los angeles california | united states | 34.1139 | -118.4068 | 3.0 | US | gangster rap, cali rap | 8 | 0.998782 | 7.990255 |
617 | richmond hill new york | united states | 45.1226 | -92.5338 | 869.0 | US | pop rap, rap | 12 | 0.658428 | 7.901134 |
745 | the bronx new york | united states | 40.6943 | -73.9249 | 64.0 | US | rap dominicano, nyc rap | 8 | 0.974067 | 7.792534 |
297 | hialeah florida | united states | 25.4418 | -80.4685 | 348.0 | US | pop rap, rap | 9 | 0.860400 | 7.743597 |
674 | santa maria california | united states | 34.9333 | -120.4432 | 1424.0 | US | cali rap, chicano rap, rap | 17 | 0.454257 | 7.722362 |
670 | santa clara california | united states | 37.3646 | -121.9679 | 774.0 | US | cali rap, rap | 11 | 0.694573 | 7.640302 |
473 | mobile alabama | united states | 30.6783 | -88.1162 | 1187.0 | US | rap, pop rap | 14 | 0.539896 | 7.558537 |
35 | arlington texas | united states | 48.1697 | -122.1446 | 165.0 | US | pop rap, dirty south rap, gangster rap | 8 | 0.933375 | 7.466998 |
65 | beaverton oregon | united states | 42.9252 | -89.3887 | 650.0 | US | cali rap, rap | 10 | 0.742226 | 7.422259 |
134 | chandler arizona | united states | 33.2827 | -111.8516 | 463.0 | US | rap, pop rap | 9 | 0.815058 | 7.335525 |
495 | murrieta california | united states | 40.0692 | -79.9152 | 858.0 | US | rap, cali rap | 11 | 0.662596 | 7.288561 |
484 | montgomery alabama | united states | 41.1709 | -76.8740 | 1248.0 | US | pop rap, rap | 14 | 0.517620 | 7.246683 |
66 | belleville michigan | united states | 38.5165 | -89.9899 | 492.0 | US | pop rap, rap | 9 | 0.803690 | 7.233206 |
178 | dallas texas | united states | 32.7937 | -96.7662 | 6.0 | US | gangster rap, dirty south rap | 7 | 0.997564 | 6.982948 |
197 | duncanville texas | united states | 29.4128 | -94.9658 | 1091.0 | US | rap, pop rap | 12 | 0.575263 | 6.903151 |
468 | miami florida | united states | 25.7840 | -80.2102 | 54.0 | US | gangster rap, dirty south rap | 7 | 0.978111 | 6.846779 |
36 | arlington virginia | united states | 38.7719 | -77.4450 | 63.0 | US | pop rap, rap | 7 | 0.974471 | 6.821298 |
144 | chino california | united states | 33.9836 | -117.6653 | 378.0 | US | cali rap | 8 | 0.848532 | 6.788257 |
646 | salt lake city utah | united states | 40.7774 | -111.9301 | 90.0 | US | pop rap | 7 | 0.963564 | 6.744948 |
239 | fontana california | united states | 36.0375 | 14.2361 | 136.0 | US | cali rap | 7 | 0.945029 | 6.615203 |
620 | riverside california | united states | 33.9381 | -117.3948 | 160.0 | US | cali rap | 7 | 0.935382 | 6.547677 |
546 | ontario california | united states | 34.0393 | -117.6064 | 172.0 | US | cali rap | 7 | 0.930565 | 6.513957 |
575 | perris california | united states | 40.0692 | -79.9152 | 1394.0 | US | rap, cali rap | 14 | 0.464959 | 6.509424 |
220 | etobicoke | canada | 48.4462 | -89.2750 | 893.0 | CA | rap, pop rap | 10 | 0.649348 | 6.493479 |
662 | san mateo california | united states | 37.5522 | -122.3122 | 939.0 | US | cali rap, rap | 10 | 0.632004 | 6.320037 |
611 | reno nevada | united states | 42.0185 | -93.4637 | 528.0 | US | cali rap | 8 | 0.789614 | 6.316911 |
349 | kissimmee florida | united states | 25.4418 | -80.4685 | 785.0 | US | pop rap, rap | 9 | 0.690371 | 6.213341 |
170 | corpus christi texas | united states | 27.7173 | -97.3822 | 792.0 | US | pop rap, rap | 9 | 0.687700 | 6.189297 |
812 | warren michigan | united states | 41.8433 | -79.1445 | 314.0 | US | rap, pop rap | 7 | 0.873883 | 6.117178 |
536 | oakville | canada | 48.4462 | -89.2750 | 657.0 | CA | pop rap, rap | 8 | 0.739522 | 5.916175 |
335 | kansas city missouri | united states | 39.1239 | -94.5541 | 103.0 | US | pop rap, country rap | 6 | 0.958320 | 5.749919 |
249 | fremont california | united states | 41.4417 | -96.4886 | 479.0 | US | cali rap | 7 | 0.808783 | 5.661478 |
624 | roseville california | united states | 38.7691 | -121.3178 | 527.0 | US | cali rap, rap | 7 | 0.790004 | 5.530030 |
527 | north hills california | united states | 40.7765 | -73.6778 | 531.0 | US | cali rap | 7 | 0.788443 | 5.519099 |
23 | anaheim california | united states | 40.0692 | -79.9152 | 206.0 | US | cali rap | 6 | 0.916940 | 5.501637 |
227 | falls church virginia | united states | 38.8847 | -77.1751 | 583.0 | US | pop rap, rap | 7 | 0.768190 | 5.377330 |
9 | akron ohio | united states | 41.0802 | -81.5219 | 591.0 | US | pop rap, rap | 7 | 0.765082 | 5.355574 |
825 | woodbridge | canada | 48.4462 | -89.2750 | 1250.0 | CA | rap, pop rap | 10 | 0.516893 | 5.168926 |
223 | fairfax virginia | united states | 47.5172 | -92.5121 | 664.0 | US | rap, pop rap | 7 | 0.736820 | 5.157737 |
813 | washington district of columbia | united states | 38.9047 | -77.0163 | 69.0 | US | dmv rap | 5 | 0.972046 | 4.860228 |
140 | cherry hill new jersey | united states | 41.2012 | -77.2666 | 845.0 | US | pop rap, rap | 7 | 0.667529 | 4.672701 |
685 | schenectady new york | united states | 40.6943 | -73.9249 | 853.0 | US | rap, pop rap | 7 | 0.664493 | 4.651450 |
328 | jamaica new york | united states | 40.6943 | -73.9249 | 1412.0 | US | rap, pop rap | 10 | 0.458533 | 4.585325 |
299 | hoboken new jersey | united states | 39.3167 | -74.6066 | 879.0 | US | pop rap, rap | 7 | 0.654642 | 4.582494 |
168 | corona new york | united states | 40.6943 | -73.9249 | 1102.0 | US | rap, pop rap | 8 | 0.571191 | 4.569530 |
17 | allen park michigan | united states | 42.2595 | -83.2107 | 685.0 | US | pop rap, rap | 6 | 0.728722 | 4.372334 |
817 | whitmore lake michigan | united states | 41.7098 | -86.8705 | 764.0 | US | pop rap, rap | 6 | 0.698396 | 4.190377 |
815 | west palm beach florida | united states | 26.7467 | -80.1314 | 802.0 | US | rap | 6 | 0.683886 | 4.103317 |
100 | brownsville texas | united states | 25.9980 | -97.4565 | 1066.0 | US | rap | 7 | 0.584533 | 4.091734 |
686 | seattle washington | united states | 38.9047 | -77.0163 | 29.0 | US | cali rap | 4 | 0.988235 | 3.952940 |
93 | brandon mississippi | united states | 32.2778 | -89.9896 | 1493.0 | US | pop rap, rap | 9 | 0.429801 | 3.868213 |
447 | maple | canada | 41.4094 | -81.5625 | 1421.0 | CA | rap, pop rap | 8 | 0.455325 | 3.642600 |
314 | ilford | united kingdom | 51.5597 | 0.0708 | 703.0 | GB | nyc rap, swedish gangsta rap | 5 | 0.721794 | 3.608968 |
593 | puyallup washington | united states | 38.9047 | -77.0163 | 770.0 | US | rap, cali rap | 5 | 0.696102 | 3.480509 |
523 | norcross georgia | united states | 33.9378 | -84.2065 | 331.0 | US | pop rap, rap | 4 | 0.867137 | 3.468547 |
645 | salinas california | united states | 40.0692 | -79.9152 | 1116.0 | US | cali rap, rap | 6 | 0.566017 | 3.396099 |
302 | hollywood florida | united states | 26.0293 | -80.1678 | 462.0 | US | rap | 4 | 0.815451 | 3.261803 |
612 | renton washington | united states | 38.9047 | -77.0163 | 577.0 | US | cali rap, pop rap | 4 | 0.770522 | 3.082089 |
160 | columbus georgia | united states | 43.3354 | -89.0300 | 608.0 | US | rap | 4 | 0.758485 | 3.033938 |
747 | thornhill | canada | 48.4462 | -89.2750 | 1045.0 | CA | rap, pop rap | 5 | 0.592340 | 2.961700 |
221 | evansville wisconsin | united states | 42.7781 | -89.2967 | 1391.0 | US | rap rock, country rap | 6 | 0.466031 | 2.796188 |
183 | dayton ohio | united states | 30.0358 | -94.9024 | 231.0 | US | country rap | 3 | 0.906942 | 2.720826 |
153 | colfax louisiana | united states | 30.2233 | -92.6582 | 268.0 | US | dirty south rap, gangster rap | 3 | 0.892179 | 2.676538 |
430 | madison mississippi | united states | 43.0808 | -89.3922 | 1629.0 | US | rap, pop rap | 7 | 0.382281 | 2.675970 |
78 | birmingham alabama | united states | 33.5276 | -86.7988 | 283.0 | US | rap | 3 | 0.886206 | 2.658618 |
13 | alexandria virginia | united states | 38.7719 | -77.4450 | 304.0 | US | pop rap | 3 | 0.877855 | 2.633564 |
8 | ajax | canada | 48.4462 | -89.2750 | 1227.0 | CA | rap | 5 | 0.525271 | 2.626355 |
469 | milton | canada | 47.2522 | -122.3154 | 1269.0 | CA | rap | 5 | 0.509988 | 2.549941 |
286 | hattiesburg mississippi | united states | 31.3072 | -89.3168 | 1316.0 | US | pop rap, rap | 5 | 0.492976 | 2.464880 |
542 | ogden utah | united states | 41.2280 | -111.9677 | 611.0 | US | pop rap | 3 | 0.757321 | 2.271964 |
326 | jackson michigan | united states | 43.3244 | -88.1668 | 641.0 | US | rap, rap rock | 3 | 0.745705 | 2.237115 |
514 | new york new york | united states | 40.6943 | -73.9249 | 7.0 | US | rap | 2 | 0.997158 | 1.994316 |
544 | omaha nebraska | united states | 42.8260 | -103.0024 | 116.0 | US | pop rap | 2 | 0.953080 | 1.906161 |
618 | ridgeland mississippi | united states | 32.4236 | -90.1481 | 1639.0 | US | rap, pop rap | 5 | 0.378825 | 1.894123 |
634 | saint paul minnesota | united states | 44.9477 | -93.1040 | 155.0 | US | pop rap | 2 | 0.937391 | 1.874781 |
12 | albuquerque new mexico | united states | 31.8195 | -106.5948 | 218.0 | US | rap | 2 | 0.912138 | 1.824277 |
184 | de witt iowa | united states | 42.7809 | -96.1743 | 1432.0 | US | country rap | 4 | 0.451410 | 1.805639 |
466 | metairie louisiana | united states | 30.2233 | -92.6582 | 1038.0 | US | pop rap, rap | 3 | 0.594946 | 1.784838 |
230 | farnborough | united kingdom | 51.0167 | -1.3167 | 1734.0 | GB | swedish gangsta rap | 5 | 0.346250 | 1.731250 |
125 | catford | united kingdom | 51.4500 | -0.0167 | 1748.0 | GB | rap | 5 | 0.341491 | 1.707457 |
90 | boucherville | canada | 48.4462 | -89.2750 | 1985.0 | CA | rap conscient | 6 | 0.262698 | 1.576189 |
471 | mitcham | united kingdom | 51.0167 | -1.3167 | 1861.0 | GB | swedish gangsta rap | 5 | 0.303495 | 1.517476 |
131 | chambly | canada | 48.4462 | -89.2750 | 1871.0 | CA | rap conscient | 5 | 0.300169 | 1.500846 |
319 | inkster michigan | united states | 41.7098 | -86.8705 | 782.0 | US | pop rap | 2 | 0.691517 | 1.383033 |
163 | concord north carolina | united states | 35.2890 | -81.5416 | 976.0 | US | rap | 2 | 0.618110 | 1.236221 |
456 | mchenry illinois | united states | 42.3388 | -88.2931 | 979.0 | US | indie pop rap | 2 | 0.616986 | 1.233972 |
831 | yakima washington | united states | 38.9047 | -77.0163 | 990.0 | US | cali rap | 2 | 0.612867 | 1.225734 |
73 | bexleyheath | united kingdom | 51.4500 | 0.1500 | 1938.0 | GB | swedish gangsta rap | 4 | 0.278046 | 1.112183 |
273 | hacienda heights california | united states | 40.0692 | -79.9152 | 1182.0 | US | cali rap | 2 | 0.541728 | 1.083457 |
199 | dunstable | united kingdom | 51.0167 | -1.3167 | 2155.0 | GB | swedish gangsta rap | 5 | 0.208468 | 1.042339 |
150 | cleveland ohio | united states | 30.3368 | -95.0924 | 43.0 | US | country rap | 1 | 0.982564 | 0.982564 |
470 | minneapolis minnesota | united states | 44.9635 | -93.2678 | 47.0 | US | country rap | 1 | 0.980944 | 0.980944 |
203 | edgware | united kingdom | 51.0167 | -1.3167 | 2054.0 | GB | swedish gangsta rap | 4 | 0.240437 | 0.961747 |
243 | fort worth texas | united states | 32.7814 | -97.3473 | 240.0 | US | pop rap | 1 | 0.903347 | 0.903347 |
463 | mesquite texas | united states | 32.7622 | -96.5889 | 245.0 | US | dirty south rap | 1 | 0.901351 | 0.901351 |
208 | el paso texas | united states | 31.8479 | -106.4309 | 256.0 | US | rap | 1 | 0.896963 | 0.896963 |
412 | lodi california | united states | 40.0692 | -79.9152 | 288.0 | US | cali rap | 1 | 0.884217 | 0.884217 |
322 | irving texas | united states | 29.4128 | -94.9658 | 293.0 | US | pop rap | 1 | 0.882228 | 0.882228 |
97 | bridgeview illinois | united states | 41.7402 | -87.8067 | 375.0 | US | chicago rap | 1 | 0.849718 | 0.849718 |
186 | dearborn michigan | united states | 42.3127 | -83.2129 | 570.0 | US | rap | 1 | 0.773245 | 0.773245 |
700 | slough | united kingdom | 51.5000 | -0.5833 | 705.0 | GB | swedish gangsta rap | 1 | 0.721025 | 0.721025 |
378 | lansing michigan | united states | 41.5646 | -87.5459 | 781.0 | US | rap rock | 1 | 0.691899 | 0.691899 |
229 | farmington michigan | united states | 42.2774 | -83.3877 | 906.0 | US | rap rock | 1 | 0.644438 | 0.644438 |
532 | nuneaton | united kingdom | 51.0167 | -1.3167 | 1822.0 | GB | swedish gangsta rap | 2 | 0.316524 | 0.633048 |
425 | luton | united kingdom | 51.8804 | -0.4200 | 996.0 | GB | swedish gangsta rap | 1 | 0.610622 | 0.610622 |
488 | morton mississippi | united states | 40.6137 | -89.4668 | 1019.0 | US | rap | 1 | 0.602029 | 0.602029 |
738 | tamworth | united kingdom | -31.1026 | 150.9171 | 1869.0 | GB | swedish gangsta rap | 2 | 0.300834 | 0.601668 |
613 | repentigny | canada | 48.4462 | -89.2750 | 1735.0 | CA | rap conscient | 1 | 0.345910 | 0.345910 |
721 | stourbridge | united kingdom | 51.0167 | -1.3167 | 1805.0 | GB | swedish gangsta rap | 1 | 0.322232 | 0.322232 |
# Hip hop markets in english speaking countries
#eshh = hh_data[hh_data['country'].isin(['united states','united kingdom','ireland','canada','australia'])].sort_values('market_importance', ascending=False)
#eshh.to_csv(os.getcwd()+'/data/hiphop_markets_in_english_speaking_countries.csv')
# Hip hop markets
eshh = hh_data.sort_values('market_importance', ascending=False)
eshh.to_csv(os.getcwd()+'/data/hiphop_markets.csv')
eshh
city | country | lat | lng | rank | country code | genre | top_genres | scale_rank | market_importance | |
---|---|---|---|---|---|---|---|---|---|---|
1202 | ludwigshafen am rhein | germany | 50.9300 | 6.9500 | 382.0 | DE | albanian hiphop, german hiphop, deep german hi... | 30 | 0.851654 | 25.549620 |
1048 | kornwestheim | germany | 48.1299 | 11.5750 | 351.0 | DE | deep german hiphop, albanian hiphop, german hi... | 28 | 0.863542 | 24.179187 |
1467 | oberasbach | germany | 48.1299 | 11.5750 | 359.0 | DE | german hiphop, deep german hiphop, albanian hi... | 28 | 0.860472 | 24.093210 |
2242 | wiesbaden | germany | 50.0804 | 8.2500 | 592.0 | DE | deep german hiphop, hamburg hiphop, albanian h... | 29 | 0.771860 | 22.383935 |
1952 | stuttgart | germany | 48.7800 | 9.2000 | 65.0 | DE | german hiphop, deep german hiphop, hamburg hiphop | 22 | 0.974481 | 21.438583 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
781 | guntur | india | 16.3300 | 80.4500 | 3036.0 | IN | desi hiphop | 3 | 0.001564 | 0.004692 |
2066 | trang | thailand | 7.5634 | 99.6080 | 3045.0 | TH | thai hiphop | 7 | 0.000455 | 0.003182 |
1555 | pattani | thailand | 6.8640 | 101.2500 | 3046.0 | TH | thai hiphop | 7 | 0.000348 | 0.002435 |
1871 | si racha | thailand | 13.1590 | 100.9287 | 3049.0 | TH | thai hiphop | 7 | 0.000066 | 0.000461 |
1666 | ratchaburi | thailand | 13.5419 | 99.8215 | 3050.0 | TH | thai hiphop | 7 | 0.000000 | 0.000000 |
2170 rows × 10 columns
Change the Rank Exponent to reduce the size of the bubbles and add more markets:
rankexp = 1.2
rock_data = tp.cities_by_genres(everygenre, rank_exponent=rankexp, genre_rank={'rock':10})
hh_data = tp.cities_by_genres(everygenre, rank_exponent=rankexp, genre_rank={'hiphop':10})
indi_data = tp.cities_by_genres(everygenre, rank_exponent=rankexp, genre_rank={'indie':10})
lati_data = tp.cities_by_genres(everygenre, rank_exponent=rankexp, genre_rank={'latin':10})
pop_data = tp.cities_by_genres(everygenre, rank_exponent=rankexp, genre_rank={'pop':10})
rap_data = tp.cities_by_genres(everygenre, rank_exponent=rankexp, genre_rank={'rap':10})
vs = reload(vs)
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks
cufflinks.go_offline(connected=True)
init_notebook_mode(connected=True)
# graph the hip hop and rap markets separately.
fig = vs.draw_genre_markets([rap_data, hh_data,rock_data,indi_data,lati_data,pop_data],
names=['Rap','Hip-Hop','Rock','Indi','Latin','Pop'],
opacity_reduction=0.9)
plot(fig, filename = 'GenreMap.html')
'GenreMap.html'
fig
import datapane as dp
dp.Report(dp.Plot(fig)).publish(name='mapping_music')
Publishing report and associated data - please wait.. Report successfully published at https://datapane.com/khuyentran1401/reports/mapping_music_d2e2d748/