You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ML-For-Beginners/5-Clustering/1-Visualize/solution/notebook.ipynb

506 lines
559 KiB

4 years ago
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python37364bit8d3b438fb5fc4430a93ac2cb74d693a7",
"display_name": "Python 3.7.0 64-bit ('3.7')"
},
"metadata": {
"interpreter": {
"hash": "70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d"
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"source": [
"# Nigerian Music scraped from Spotify - an analysis"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Requirement already satisfied: seaborn in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.11.1)\n",
4 years ago
"Requirement already satisfied: scipy>=1.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from seaborn) (1.4.1)\n",
"Requirement already satisfied: numpy>=1.15 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from seaborn) (1.19.2)\n",
4 years ago
"Requirement already satisfied: pandas>=0.23 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from seaborn) (1.1.2)\n",
"Requirement already satisfied: matplotlib>=2.2 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from seaborn) (3.1.0)\n",
4 years ago
"Requirement already satisfied: python-dateutil>=2.7.3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas>=0.23->seaborn) (2.8.0)\n",
"Requirement already satisfied: pytz>=2017.2 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas>=0.23->seaborn) (2019.1)\n",
4 years ago
"Requirement already satisfied: kiwisolver>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from matplotlib>=2.2->seaborn) (1.1.0)\n",
4 years ago
"Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from matplotlib>=2.2->seaborn) (0.10.0)\n",
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from matplotlib>=2.2->seaborn) (2.4.0)\n",
"Requirement already satisfied: six>=1.5 in /Users/jenlooper/Library/Python/3.7/lib/python/site-packages (from python-dateutil>=2.7.3->pandas>=0.23->seaborn) (1.12.0)\n",
"Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib>=2.2->seaborn) (45.1.0)\n",
"\u001b[33mWARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.\n",
"You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -m pip install --upgrade pip' command.\u001b[0m\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install seaborn"
]
},
{
"cell_type": "code",
"execution_count": 21,
4 years ago
"metadata": {},
"outputs": [
{
4 years ago
"output_type": "execute_result",
"data": {
"text/plain": [
" name album \\\n",
"0 Sparky Mandy & The Jungle \n",
"1 shuga rush EVERYTHING YOU HEARD IS TRUE \n",
"2 LITT! LITT! \n",
"3 Confident / Feeling Cool Enjoy Your Life \n",
"4 wanted you rare. \n",
"\n",
" artist artist_top_genre release_date length popularity \\\n",
"0 Cruel Santino alternative r&b 2019 144000 48 \n",
"1 Odunsi (The Engine) afropop 2020 89488 30 \n",
"2 AYLØ indie r&b 2018 207758 40 \n",
"3 Lady Donli nigerian pop 2019 175135 14 \n",
"4 Odunsi (The Engine) afropop 2018 152049 25 \n",
"\n",
" danceability acousticness energy instrumentalness liveness loudness \\\n",
"0 0.666 0.8510 0.420 0.534000 0.1100 -6.699 \n",
"1 0.710 0.0822 0.683 0.000169 0.1010 -5.640 \n",
"2 0.836 0.2720 0.564 0.000537 0.1100 -7.127 \n",
"3 0.894 0.7980 0.611 0.000187 0.0964 -4.961 \n",
"4 0.702 0.1160 0.833 0.910000 0.3480 -6.044 \n",
"\n",
" speechiness tempo time_signature \n",
"0 0.0829 133.015 5 \n",
"1 0.3600 129.993 3 \n",
"2 0.0424 130.005 4 \n",
"3 0.1130 111.087 4 \n",
"4 0.0447 105.115 4 "
],
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>name</th>\n <th>album</th>\n <th>artist</th>\n <th>artist_top_genre</th>\n <th>release_date</th>\n <th>length</th>\n <th>popularity</th>\n <th>danceability</th>\n <th>acousticness</th>\n <th>energy</th>\n <th>instrumentalness</th>\n <th>liveness</th>\n <th>loudness</th>\n <th>speechiness</th>\n <th>tempo</th>\n <th>time_signature</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Sparky</td>\n <td>Mandy &amp; The Jungle</td>\n <td>Cruel Santino</td>\n <td>alternative r&amp;b</td>\n <td>2019</td>\n <td>144000</td>\n <td>48</td>\n <td>0.666</td>\n <td>0.8510</td>\n <td>0.420</td>\n <td>0.534000</td>\n <td>0.1100</td>\n <td>-6.699</td>\n <td>0.0829</td>\n <td>133.015</td>\n <td>5</td>\n </tr>\n <tr>\n <th>1</th>\n <td>shuga rush</td>\n <td>EVERYTHING YOU HEARD IS TRUE</td>\n <td>Odunsi (The Engine)</td>\n <td>afropop</td>\n <td>2020</td>\n <td>89488</td>\n <td>30</td>\n <td>0.710</td>\n <td>0.0822</td>\n <td>0.683</td>\n <td>0.000169</td>\n <td>0.1010</td>\n <td>-5.640</td>\n <td>0.3600</td>\n <td>129.993</td>\n <td>3</td>\n </tr>\n <tr>\n <th>2</th>\n <td>LITT!</td>\n <td>LITT!</td>\n <td>AYLØ</td>\n <td>indie r&amp;b</td>\n <td>2018</td>\n <td>207758</td>\n <td>40</td>\n <td>0.836</td>\n <td>0.2720</td>\n <td>0.564</td>\n <td>0.000537</td>\n <td>0.1100</td>\n <td>-7.127</td>\n <td>0.0424</td>\n <td>130.005</td>\n <td>4</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Confident / Feeling Cool</td>\n <td>Enjoy Your Life</td>\n <td>Lady Donli</td>\n <td>nigerian pop</td>\n <td>2019</td>\n <td>175135</td>\n <td>14</td>\n <td>0.894</td>\n <td>0.7980</td>\n <td>0.611</td>\n <td>0.000187</td>\n <td>0.0964</td>\n <td>-4.961</td>\n <td>0.1130</td>\n <td>111.087</td>\n <td>4</td>\n </tr>\n <tr>\n <th>4</th>\n <td>wanted you</td>\n <td>rare.</td>\n <td>Odunsi (The Engine)</td>\n <td>afropop</td>\n <td>2018</td>\n <td>152049</td>\n <td>25</td>\n <td>0.702</td>\n <td>0.1160</td>\n <td>0.833</td>\n <td>0.910000</td>\n <td>0.3480</td>\n <td>-6.044</td>\n <td>0.0447</td>\n <td>105.115</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 21
4 years ago
}
],
"source": [
"\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"\n",
"df = pd.read_csv(\"../../data/nigerian-songs.csv\")\n",
"df.head()"
]
},
{
"source": [
"Get information about the dataframe"
],
"cell_type": "markdown",
"metadata": {}
},
{
"source": [
"df.info()"
],
4 years ago
"cell_type": "code",
"metadata": {},
"execution_count": 22,
4 years ago
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 530 entries, 0 to 529\nData columns (total 16 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 name 530 non-null object \n 1 album 530 non-null object \n 2 artist 530 non-null object \n 3 artist_top_genre 530 non-null object \n 4 release_date 530 non-null int64 \n 5 length 530 non-null int64 \n 6 popularity 530 non-null int64 \n 7 danceability 530 non-null float64\n 8 acousticness 530 non-null float64\n 9 energy 530 non-null float64\n 10 instrumentalness 530 non-null float64\n 11 liveness 530 non-null float64\n 12 loudness 530 non-null float64\n 13 speechiness 530 non-null float64\n 14 tempo 530 non-null float64\n 15 time_signature 530 non-null int64 \ndtypes: float64(8), int64(4), object(4)\nmemory usage: 66.4+ KB\n"
]
}
]
},
{
"source": [
"Double-check for null values."
],
"cell_type": "code",
"metadata": {},
"execution_count": 23,
"outputs": [
{
"output_type": "error",
"ename": "SyntaxError",
"evalue": "invalid syntax (<ipython-input-23-33dd3e912c4b>, line 1)",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-23-33dd3e912c4b>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m Double-check for null values.\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"name 0\n",
"album 0\n",
"artist 0\n",
"artist_top_genre 0\n",
"release_date 0\n",
"length 0\n",
"popularity 0\n",
"danceability 0\n",
"acousticness 0\n",
"energy 0\n",
"instrumentalness 0\n",
"liveness 0\n",
"loudness 0\n",
"speechiness 0\n",
"tempo 0\n",
"time_signature 0\n",
"dtype: int64"
]
},
"metadata": {},
"execution_count": 19
}
],
"source": [
"df.isnull().sum()"
]
},
{
"source": [
"Look at the general values of the data. Note that popularity can be '0' - and there are many rows with that value"
],
"cell_type": "markdown",
"metadata": {}
4 years ago
},
{
"cell_type": "code",
4 years ago
"execution_count": 5,
4 years ago
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" release_date length popularity danceability acousticness \\\n",
"count 530.000000 530.000000 530.000000 530.000000 530.000000 \n",
"mean 2015.390566 222298.169811 17.507547 0.741619 0.265412 \n",
"std 3.131688 39696.822259 18.992212 0.117522 0.208342 \n",
"min 1998.000000 89488.000000 0.000000 0.255000 0.000665 \n",
"25% 2014.000000 199305.000000 0.000000 0.681000 0.089525 \n",
"50% 2016.000000 218509.000000 13.000000 0.761000 0.220500 \n",
"75% 2017.000000 242098.500000 31.000000 0.829500 0.403000 \n",
"max 2020.000000 511738.000000 73.000000 0.966000 0.954000 \n",
"\n",
" energy instrumentalness liveness loudness speechiness \\\n",
"count 530.000000 530.000000 530.000000 530.000000 530.000000 \n",
"mean 0.760623 0.016305 0.147308 -4.953011 0.130748 \n",
"std 0.148533 0.090321 0.123588 2.464186 0.092939 \n",
"min 0.111000 0.000000 0.028300 -19.362000 0.027800 \n",
"25% 0.669000 0.000000 0.075650 -6.298750 0.059100 \n",
"50% 0.784500 0.000004 0.103500 -4.558500 0.097950 \n",
"75% 0.875750 0.000234 0.164000 -3.331000 0.177000 \n",
"max 0.995000 0.910000 0.811000 0.582000 0.514000 \n",
"\n",
" tempo time_signature \n",
"count 530.000000 530.000000 \n",
"mean 116.487864 3.986792 \n",
"std 23.518601 0.333701 \n",
"min 61.695000 3.000000 \n",
"25% 102.961250 4.000000 \n",
"50% 112.714500 4.000000 \n",
"75% 125.039250 4.000000 \n",
"max 206.007000 5.000000 "
],
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>release_date</th>\n <th>length</th>\n <th>popularity</th>\n <th>danceability</th>\n <th>acousticness</th>\n <th>energy</th>\n <th>instrumentalness</th>\n <th>liveness</th>\n <th>loudness</th>\n <th>speechiness</th>\n <th>tempo</th>\n <th>time_signature</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>count</th>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n <td>530.000000</td>\n </tr>\n <tr>\n <th>mean</th>\n <td>2015.390566</td>\n <td>222298.169811</td>\n <td>17.507547</td>\n <td>0.741619</td>\n <td>0.265412</td>\n <td>0.760623</td>\n <td>0.016305</td>\n <td>0.147308</td>\n <td>-4.953011</td>\n <td>0.130748</td>\n <td>116.487864</td>\n <td>3.986792</td>\n </tr>\n <tr>\n <th>std</th>\n <td>3.131688</td>\n <td>39696.822259</td>\n <td>18.992212</td>\n <td>0.117522</td>\n <td>0.208342</td>\n <td>0.148533</td>\n <td>0.090321</td>\n <td>0.123588</td>\n <td>2.464186</td>\n <td>0.092939</td>\n <td>23.518601</td>\n <td>0.333701</td>\n </tr>\n <tr>\n <th>min</th>\n <td>1998.000000</td>\n <td>89488.000000</td>\n <td>0.000000</td>\n <td>0.255000</td>\n <td>0.000665</td>\n <td>0.111000</td>\n <td>0.000000</td>\n <td>0.028300</td>\n <td>-19.362000</td>\n <td>0.027800</td>\n <td>61.695000</td>\n <td>3.000000</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>2014.000000</td>\n <td>199305.000000</td>\n <td>0.000000</td>\n <td>0.681000</td>\n <td>0.089525</td>\n <td>0.669000</td>\n <td>0.000000</td>\n <td>0.075650</td>\n <td>-6.298750</td>\n <td>0.059100</td>\n <td>102.961250</td>\n <td>4.000000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>2016.000000</td>\n <td>218509.000000</td>\n <td>13.000000</td>\n <td>0.761000</td>\n <td>0.220500</td>\n <td>0.784500</td>\n <td>0.000004</td>\n <td>0.103500</td>\n <td>-4.558500</td>\n <td>0.097950</td>\n <td>112.714500</td>\n <td>4.000000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>2017.000000</td>\n <td>242098.500000</td>\n <td>31.000000</td>\n <td>0.829500</td>\n <td>0.403000</td>\n <td>0.875750</td>\n <td>0.000234</td>\n <td>0.164000</td>\n <td>-3.331000</td>\n <td>0.177000</td>\n <td>125.039250</td>\n <td>4.000000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>2020.000000</td>\n <td>511738.000000</td>\n <td>73.000000</td>\n <td>0.966000</td>\n <td>0.954000</td>\n <td>0.995000</td>\n <td>0.910000</td>\n <td>0.811000</td>\n <td>0.582000</td>\n <td>0.514000</td>\n <td>206.007000</td>\n <td>5.000000</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
4 years ago
"execution_count": 5
4 years ago
}
],
"source": [
"df.describe()"
]
},
{
"source": [
"Let's examine the genres. Quite a few are listed as 'Missing' which means they aren't categorized in the dataset with a genre "
],
"cell_type": "code",
"metadata": {},
"execution_count": null,
"outputs": []
},
4 years ago
{
"cell_type": "code",
4 years ago
"execution_count": 6,
4 years ago
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"Text(0.5, 1.0, 'Top genres')"
]
},
"metadata": {},
4 years ago
"execution_count": 6
4 years ago
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x504 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"474.468454pt\" version=\"1.1\" viewBox=\"0 0 598.4875 474.468454\" width=\"598.4875pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 474.468454 \nL 598.4875 474.468454 \nL 598.4875 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 33.2875 402.838125 \nL 591.2875 402.838125 \nL 591.2875 22.318125 \nL 33.2875 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p52e03846d0)\" d=\"M 44.4475 402.838125 \nL 133.7275 402.838125 \nL 133.7275 40.438125 \nL 44.4475 40.438125 \nz\n\" style=\"fill:#3274a1;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p52e03846d0)\" d=\"M 156.0475 402.838125 \nL 245.3275 402.838125 \nL 245.3275 303.399101 \nL 156.0475 303.399101 \nz\n\" style=\"fill:#e1812c;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p52e03846d0)\" d=\"M 267.6475 402.838125 \nL 356.9275 402.838125 \nL 356.9275 344.279588 \nL 267.6475 344.279588 \nz\n\" style=\"fill:#3a923a;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p52e03846d0)\" d=\"M 379.2475 402.838125 \nL 468.5275 402.838125 \nL 468.5275 376.321052 \nL 379.2475 376.321052 \nz\n\" style=\"fill:#c03d3e;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p52e03846d0)\" d=\"M 490.8475 402.838125 \nL 580.1275 402.838125 \nL 580.1275 393.999101 \nL 490.8475 393.999101 \nz\n\" style=\"fill:#9372b2;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"m2e7cf57eb5\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"89.0875\" xlink:href=\"#m2e7cf57eb5\" y=\"402.838125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- afro dancehall -->\n <defs>\n <path d=\"M 34.28125 27.484375 \nQ 23.390625 27.484375 19.1875 25 \nQ 14.984375 22.515625 14.984375 16.5 \nQ 14.984375 11.71875 18.140625 8.90625 \nQ 21.296875 6.109375 26.703125 6.109375 \nQ 34.1875 6.109375 38.703125 11.40625 \nQ 43.21875 16.703125 43.21875 25.484375 \nL 43.21875 27.484375 \nz\nM 52.203125 31.203125 \nL 52.203125 0 \nL 43.21875 0 \nL 43.21875 8.296875 \nQ 40.140625 3.328125 35.546875 0.953125 \nQ 30.953125 -1.421875 24.3125 -1.421875 \nQ 15.921875 -1.421875 10.953125 3.296875 \nQ 6 8.015625 6 15.921875 \nQ 6 25.140625 12.171875 29.828125 \nQ 18.359375 34.515625 30.609375 34.515625 \nL 43.21875 34.515625 \nL 43.21875 35.40625 \nQ 43.21875 41.609375 39.140625 45 \nQ 35.0625 48.390625 27.6875 48.390625 \nQ 23 48.390625 18.546875 47.265625 \nQ 14.109375 46.140625 10.015625 43.890625 \nL 10.015625 52.203125 \nQ 14.9375 54.109375 19.578125 55.046875 \nQ 24.21875 56 28.609375 56 \nQ 40.484375 56 46.34375 49.84375 \nQ 52.203125 43.703125 52.203125 31.203125 \nz\n\" id=\"DejaVuSans-97\"/>\n <path d=\"M 37.109375 75.984375 \nL 37.109375 68.5 \nL 28.515625 68.5 \nQ 23.6875 68.5 21.796875 66.546875 \nQ 19.921875 64.59375 19.921875 59.515625 \nL 19.921875 54.6875 \nL 34.71875 54.6875 \nL 34.71875 47.703125 \nL 19.921875 47.703125 \nL 19.921875 0 \nL 10.890625 0 \nL 10.890625 47.703125 \nL 2.296875 47.703125 \nL 2.296875 54.6875 \nL 10.890625 54.6875 \nL 10.890625 58.5 \nQ 10.890625 67.625 15.140625 71.796875 \nQ 19.390625 75.984375 28.609375 75.984375 \nz\n\" id=\"DejaVuSans-102\"/>\n <path d=\"M 41.109375 46.296875 \nQ 39.59375 47.171875 37.8125 47.578125 \nQ 36.03125 48 33.890625 48 \nQ 26.265625 48 22.1875 43.046875 \nQ 18.109375 38.09375 18.109375 28.8125 \nL
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlYAAAHbCAYAAAAJY9SEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3de7zt9ZzH8de7TuWSUelIN3JpIrdwpBGKJiW6DZGUEBkVNXIbg8owg4bccyfGRK6Fxi3SaMalkqimcSTq6HKSQohTn/nj+9tj2XPq3L67tfbZr+fjcR5nrd/vt9b+1Dp7rff6XlNVSJIkadWtMe4CJEmSVhcGK0mSpE4MVpIkSZ0YrCRJkjoxWEmSJHVisJIkSerEYCVJktSJwUpSdwm/GflzU8LvRu4/bdz1SdJMiQuESppJCZcAz67iq+OuZVUkzKtiybjrkDTZbLGSdKtLuG3COxIuT7gs4diEtYZzuyYsTDgm4ZqEnyTscwvPtWXCfyb8OuGLCe9OeN/I+UcmfDvh2oRzErYfOfethKOGv3+VcGrC+sO5eycsSXhOwqXAqcvxfM9JuGSo5eJbqlvS6slgJWkcjgEeANwfeAiwI/CSkfNbAGsDdwGeA5yQcPfpT5IQ4CTg68CdgNcB+4+c3wL4LPAPwAbAK4DPToWnwX7A04CNgfWAw0fOrQk8DNgK2POWnm94zmOBnaq4A/AI4Icr8j9F0uxnsJI0Dk8Djqri6iquBF4DHDByfglwTBV/GLoQvwo8aSnPsyVwb+DVw7WnA/8+cv5A4NNVfLWKm6o4FbgAeOzINe+t4sdVXA98Ethm2s94V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
"metadata": {
"needs_background": "light"
}
4 years ago
}
],
"source": [
"import seaborn as sns\n",
"\n",
4 years ago
"top = df['artist_top_genre'].value_counts()\n",
"plt.figure(figsize=(10,7))\n",
"sns.barplot(x=top[:5].index,y=top[:5].values)\n",
"plt.xticks(rotation=45)\n",
"plt.title('Top genres',color = 'blue')"
]
},
{
"source": [
"Remove 'Missing' genres, as it's not classified in Spotify\n"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
4 years ago
"execution_count": 7,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"Text(0.5, 1.0, 'Top genres')"
]
},
"metadata": {},
4 years ago
"execution_count": 7
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x504 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"493.84097pt\" version=\"1.1\" viewBox=\"0 0 598.679194 493.84097\" width=\"598.679194pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 493.84097 \nL 598.679194 493.84097 \nL 598.679194 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 33.2875 402.838125 \nL 591.2875 402.838125 \nL 591.2875 22.318125 \nL 33.2875 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 36.3875 402.838125 \nL 61.1875 402.838125 \nL 61.1875 40.438125 \nL 36.3875 40.438125 \nz\n\" style=\"fill:#ea96a3;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 67.3875 402.838125 \nL 92.1875 402.838125 \nL 92.1875 303.399101 \nL 67.3875 303.399101 \nz\n\" style=\"fill:#e7957e;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 98.3875 402.838125 \nL 123.1875 402.838125 \nL 123.1875 376.321052 \nL 98.3875 376.321052 \nz\n\" style=\"fill:#d1964d;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 129.3875 402.838125 \nL 154.1875 402.838125 \nL 154.1875 393.999101 \nL 129.3875 393.999101 \nz\n\" style=\"fill:#b89c49;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 160.3875 402.838125 \nL 185.1875 402.838125 \nL 185.1875 395.103979 \nL 160.3875 395.103979 \nz\n\" style=\"fill:#a29f46;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 191.3875 402.838125 \nL 216.1875 402.838125 \nL 216.1875 398.418613 \nL 191.3875 398.418613 \nz\n\" style=\"fill:#8ca646;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 222.3875 402.838125 \nL 247.1875 402.838125 \nL 247.1875 399.523491 \nL 222.3875 399.523491 \nz\n\" style=\"fill:#60ae47;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 253.3875 402.838125 \nL 278.1875 402.838125 \nL 278.1875 399.523491 \nL 253.3875 399.523491 \nz\n\" style=\"fill:#49af7c;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 284.3875 402.838125 \nL 309.1875 402.838125 \nL 309.1875 401.733247 \nL 284.3875 401.733247 \nz\n\" style=\"fill:#4aad95;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 315.3875 402.838125 \nL 340.1875 402.838125 \nL 340.1875 401.733247 \nL 315.3875 401.733247 \nz\n\" style=\"fill:#4baba4;\"/>\n </g>\n <g id=\"patch_13\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 346.3875 402.838125 \nL 371.1875 402.838125 \nL 371.1875 401.733247 \nL 346.3875 401.733247 \nz\n\" style=\"fill:#4dabb3;\"/>\n </g>\n <g id=\"patch_14\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 377.3875 402.838125 \nL 402.1875 402.838125 \nL 402.1875 401.733247 \nL 377.3875 401.733247 \nz\n\" style=\"fill:#51acc7;\"/>\n </g>\n <g id=\"patch_15\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 408.3875 402.838125 \nL 433.1875 402.838125 \nL 433.1875 401.733247 \nL 408.3875 401.733247 \nz\n\" style=\"fill:#6daee2;\"/>\n </g>\n <g id=\"patch_16\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 439.3875 402.838125 \nL 464.1875 402.838125 \nL 464.1875 401.733247 \nL 439.3875 401.733247 \nz\n\" style=\"fill:#a6acea;\"/>\n </g>\n <g id=\"patch_17\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 470.3875 402.838125 \nL 495.1875 402.838125 \nL 495.1875 401.733247 \nL 470.3875 401.733247 \nz\n\" style=\"fill:#c4a1ea;\"/>\n </g>\n <g id=\"patch_18\">\n <path clip-path=\"url(#p58b4920743)\" d=\"M 501.3
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlYAAAHuCAYAAABd1EKaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nOzdd5glVZn48e/LDDmHI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SY0YWEmSJDViYCVJktSIgZUkSVIjBlaSJEmNGFhJkiQ1YmAlSZLUiIGVJElSIwZWkiRJjRhYSZIkNWJgJUmS1IiBlSRJUiMGVpIkSY0YWEmSJDViYCVJktSIgZUkSVIjBlaSJEmNGFhJkiQ1YmAlSZLUiIGVJElSIwZWkiRJjRhYSZIkNWJgJUmS1IiBlSRJUiMGVpIkSY0YWEmSJDViYCVJktSIgZUkSVIjBlaSJEmNGFhJkiQ1YmAlSZLUiIGVJElSIwZWkiRJjRhYSZIkNWJgJUmS1IiBlSRJUiMGVpIkSY0YWEmSJDViYCVJktSIgZUkSVIjcwysImKViPhKRNwVEXdGxPF1/lIR8aWI+Gn9d8k6PyLivIi4JyJ+GBEbDnojJEmSpoLR1Fg9BryulLIOsBlwdESsA5wC3FJKWRO4pU4DvARYs/4dAVzUPNWSJElT0BwDq1LKQ6WU79fPfwTuBlYC9gAuqz+7DNizft4D+FhJ3waWiIgVmqdckiRpihlTH6uImAlsAHwHWK6U8lD96mFgufp5JeD+zn97oM4bvqwjIuLWiLh11qxZY0y2JEnS1DPqwCoiFgGuAk4opfyh+10ppQBlLCsupVxcStmolLLRjBkzxvJfJUmSpqRRBVYRMS8ZVH2ilHJ1nf1Ir4mv/vtonf8gsEr
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"df = df[df['artist_top_genre'] != 'Missing']\n",
"top = df['artist_top_genre'].value_counts()\n",
"plt.figure(figsize=(10,7))\n",
"sns.barplot(x=top.index,y=top.values)\n",
"plt.xticks(rotation=45)\n",
"plt.title('Top genres',color = 'blue')"
]
},
{
"source": [
"The top three genres comprise the greatest part of the dataset, so let's focus on those"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
4 years ago
"execution_count": 8,
"metadata": {},
"outputs": [
{
4 years ago
"output_type": "execute_result",
"data": {
"text/plain": [
"Text(0.5, 1.0, 'Top genres')"
]
},
"metadata": {},
"execution_count": 8
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x504 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"474.468454pt\" version=\"1.1\" viewBox=\"0 0 598.4875 474.468454\" width=\"598.4875pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 474.468454 \nL 598.4875 474.468454 \nL 598.4875 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 33.2875 402.838125 \nL 591.2875 402.838125 \nL 591.2875 22.318125 \nL 33.2875 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p2ee7cc8325)\" d=\"M 51.8875 402.838125 \nL 200.6875 402.838125 \nL 200.6875 40.438125 \nL 51.8875 40.438125 \nz\n\" style=\"fill:#3274a1;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p2ee7cc8325)\" d=\"M 237.8875 402.838125 \nL 386.6875 402.838125 \nL 386.6875 295.525504 \nL 237.8875 295.525504 \nz\n\" style=\"fill:#e1812c;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p2ee7cc8325)\" d=\"M 423.8875 402.838125 \nL 572.6875 402.838125 \nL 572.6875 369.412882 \nL 423.8875 369.412882 \nz\n\" style=\"fill:#3a923a;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"mf04a56a109\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"126.2875\" xlink:href=\"#mf04a56a109\" y=\"402.838125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- afro dancehall -->\n <defs>\n <path d=\"M 34.28125 27.484375 \nQ 23.390625 27.484375 19.1875 25 \nQ 14.984375 22.515625 14.984375 16.5 \nQ 14.984375 11.71875 18.140625 8.90625 \nQ 21.296875 6.109375 26.703125 6.109375 \nQ 34.1875 6.109375 38.703125 11.40625 \nQ 43.21875 16.703125 43.21875 25.484375 \nL 43.21875 27.484375 \nz\nM 52.203125 31.203125 \nL 52.203125 0 \nL 43.21875 0 \nL 43.21875 8.296875 \nQ 40.140625 3.328125 35.546875 0.953125 \nQ 30.953125 -1.421875 24.3125 -1.421875 \nQ 15.921875 -1.421875 10.953125 3.296875 \nQ 6 8.015625 6 15.921875 \nQ 6 25.140625 12.171875 29.828125 \nQ 18.359375 34.515625 30.609375 34.515625 \nL 43.21875 34.515625 \nL 43.21875 35.40625 \nQ 43.21875 41.609375 39.140625 45 \nQ 35.0625 48.390625 27.6875 48.390625 \nQ 23 48.390625 18.546875 47.265625 \nQ 14.109375 46.140625 10.015625 43.890625 \nL 10.015625 52.203125 \nQ 14.9375 54.109375 19.578125 55.046875 \nQ 24.21875 56 28.609375 56 \nQ 40.484375 56 46.34375 49.84375 \nQ 52.203125 43.703125 52.203125 31.203125 \nz\n\" id=\"DejaVuSans-97\"/>\n <path d=\"M 37.109375 75.984375 \nL 37.109375 68.5 \nL 28.515625 68.5 \nQ 23.6875 68.5 21.796875 66.546875 \nQ 19.921875 64.59375 19.921875 59.515625 \nL 19.921875 54.6875 \nL 34.71875 54.6875 \nL 34.71875 47.703125 \nL 19.921875 47.703125 \nL 19.921875 0 \nL 10.890625 0 \nL 10.890625 47.703125 \nL 2.296875 47.703125 \nL 2.296875 54.6875 \nL 10.890625 54.6875 \nL 10.890625 58.5 \nQ 10.890625 67.625 15.140625 71.796875 \nQ 19.390625 75.984375 28.609375 75.984375 \nz\n\" id=\"DejaVuSans-102\"/>\n <path d=\"M 41.109375 46.296875 \nQ 39.59375 47.171875 37.8125 47.578125 \nQ 36.03125 48 33.890625 48 \nQ 26.265625 48 22.1875 43.046875 \nQ 18.109375 38.09375 18.109375 28.8125 \nL 18.109375 0 \nL 9.078125 0 \nL 9.078125 54.6875 \nL 18.109375 54.6875 \nL 18.109375 46.1875 \nQ 20.953125 51.171875 25.484375 53.578125 \nQ 30.03125 56 36.53125 56 \nQ 37.453125 56 38.578125 55.875 \nQ 39.703125 55.765625 41.0625 55.515625 \nz\n\" id=\"DejaVuSans-114\"/>\n <path d=\"M 30.609375 48.390625 \nQ 23.390625 48.390625 19.1875 42.75 \nQ 14.984375 37.109375 14.984375 27.296875 \nQ 14.984375 17.4
4 years ago
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlYAAAHbCAYAAAAJY9SEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3de7ymc73/8dfbjNROhUwINR0msjvInk07hZLILofaiSJKTQfS+biT2NXu3O6oKL+0f6WURG0dpIOdnTJkO5UMEdNgoaQIw2f/cV1Td2ONGbO+y32vNa/n47Ee676/13Vf9yetWet9f09XqgpJkiRN3GrDLkCSJGm6MFhJkiQ1YrCSJElqxGAlSZLUiMFKkiSpEYOVJElSIwYrSZKkRgxWkiZFwh8Hvm5PuGng+fOHXZ8kTYa4QaikyZZwKfDiKr437FomImFmFYuHXYek0WWPlaShSLhXwicSFiVckfD+hNX7YzslLEg4NOG6hF8nPOdOrjUn4X8Sbkj4dsKnEz4zcPxJCT9N+H3CWQlbDxw7PeGQ/vsfEk5KWLs/tmnC4oSXJ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RgJUmS1IjBSpIkqRGDlSRJUiMGK0mSpEYMVpIkSY0YrCRJkhoxWEmSJDVisJIkSWrEYCVJktSIwUqSJKkRg5UkSVIjBitJkqRGDFaSJEmNLDdYJTkqydVJzhtoe3+SXyY5J8nxSdbq22cnuSnJ2f3XpyazeEmSpFGyIj1WnwN2WqrtZOBRVfUY4FfAWwaOXVxVm/dfL2tTpiRJ0uhbbrCqqlOB65Zq+25VLe6fng5sNAm1SZIkTSkt5li9CPjWwPOHJPl5kh8ledKyXpRkXpL5Sea
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"df = df[(df['artist_top_genre'] == 'afro dancehall') | (df['artist_top_genre'] == 'afropop') | (df['artist_top_genre'] == 'nigerian pop')]\n",
4 years ago
"df = df[(df['popularity'] > 0)]\n",
"top = df['artist_top_genre'].value_counts()\n",
"plt.figure(figsize=(10,7))\n",
"sns.barplot(x=top.index,y=top.values)\n",
"plt.xticks(rotation=45)\n",
"plt.title('Top genres',color = 'blue')"
]
},
{
"source": [
"The data is not strongly correlated except between energy and loudness, which makes sense. Popularity has a correspondence to release data, which also makes sense, as more recent songs are probably more popular. Length and energy seem to have a correlation - perhaps shorter songs are more energetic?"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
4 years ago
"execution_count": 10,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 864x648 with 2 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"601.100156pt\" version=\"1.1\" viewBox=\"0 0 686.52575 601.100156\" width=\"686.52575pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 601.100156 \nL 686.52575 601.100156 \nL 686.52575 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 100.860938 500.239219 \nL 590.100937 500.239219 \nL 590.100937 10.999219 \nL 100.860938 10.999219 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"QuadMesh_1\">\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 100.860938 10.999219 \nL 141.630938 10.999219 \nL 141.630938 51.769219 \nL 100.860938 51.769219 \nL 100.860938 10.999219 \n\" style=\"fill:#faebdd;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 141.630938 10.999219 \nL 182.400937 10.999219 \nL 182.400937 51.769219 \nL 141.630938 51.769219 \nL 141.630938 10.999219 \n\" style=\"fill:#03051a;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 182.400937 10.999219 \nL 223.170937 10.999219 \nL 223.170937 51.769219 \nL 182.400937 51.769219 \nL 182.400937 10.999219 \n\" style=\"fill:#d3214b;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 223.170937 10.999219 \nL 263.940938 10.999219 \nL 263.940938 51.769219 \nL 223.170937 51.769219 \nL 223.170937 10.999219 \n\" style=\"fill:#bc1656;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 263.940938 10.999219 \nL 304.710938 10.999219 \nL 304.710938 51.769219 \nL 263.940938 51.769219 \nL 263.940938 10.999219 \n\" style=\"fill:#c11754;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 304.710938 10.999219 \nL 345.480937 10.999219 \nL 345.480937 51.769219 \nL 304.710938 51.769219 \nL 304.710938 10.999219 \n\" style=\"fill:#34193d;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 345.480937 10.999219 \nL 386.250937 10.999219 \nL 386.250937 51.769219 \nL 345.480937 51.769219 \nL 345.480937 10.999219 \n\" style=\"fill:#971c5b;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 386.250937 10.999219 \nL 427.020937 10.999219 \nL 427.020937 51.769219 \nL 386.250937 51.769219 \nL 386.250937 10.999219 \n\" style=\"fill:#7d1f5a;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 427.020937 10.999219 \nL 467.790937 10.999219 \nL 467.790937 51.769219 \nL 427.020937 51.769219 \nL 427.020937 10.999219 \n\" style=\"fill:#661f54;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 467.790937 10.999219 \nL 508.560937 10.999219 \nL 508.560937 51.769219 \nL 467.790937 51.769219 \nL 467.790937 10.999219 \n\" style=\"fill:#821e5a;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 508.560937 10.999219 \nL 549.330938 10.999219 \nL 549.330938 51.769219 \nL 508.560937 51.769219 \nL 508.560937 10.999219 \n\" style=\"fill:#981b5b;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 549.330938 10.999219 \nL 590.100937 10.999219 \nL 590.100937 51.769219 \nL 549.330938 51.769219 \nL 549.330938 10.999219 \n\" style=\"fill:#7d1f5a;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 100.860938 51.769219 \nL 141.630938 51.769219 \nL 141.630938 92.539219 \nL 100.860938 92.539219 \nL 100.860938 51.769219 \n\" style=\"fill:#03051a;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 141.630938 51.769219 \nL 182.400937 51.769219 \nL 182.400937 92.539219 \nL 141.630938 92.539219 \nL 141.630938 51.769219 \n\" style=\"fill:#faebdd;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 182.400937 51.769219 \nL 223.170937 51.769219 \nL 223.170937 92.539219 \nL 182.400937 92.539219 \nL 182.400937 51.769219 \n\" style=\"fill:#751f58;\"/>\n <path clip-path=\"url(#p2a0fe7be4a)\" d=\"M 223.170937 51.769219 \nL 263.940938 51.769219 \nL 263.940938 92.539219 \nL 223.
4 years ago
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAq4AAAJZCAYAAABoaLenAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nOzde7xcVX3//9ebkAASBBWkXIsFLCKXCIGqKN6QUqSASsXbV6nUVK1apWrpF6Uo9Vcsbb1U9Nt4wwtVFG+pUsEiFEXQhFu4CSLQglgQFQSBEHI+vz9mR4fjOWeSnBxm78zr6WM/zp6116z12ZMYPucza9akqpAkSZLabr1hByBJkiStChNXSZIkdYKJqyRJkjrBxFWSJEmdYOIqSZKkTjBxlSRJUieYuEqSJGm1JTkoybVJrk9y7ATXt09ybpJLkyxNcvC053QfV0mSJK2OJLOA64DnArcAi4GXVNXVfX0WApdW1YeT7AqcWVU7TGdeK66SJElaXfsC11fVDVX1APA54LBxfQp4ZHO+KXDrdCddf7oDSJIkaeRsA9zc9/gW4A/G9TkBODvJG4CNgQOmO6mJawstv+OGVq/f2Gjrpw87hIEu2/ZJww5hoNt+tfGwQxhodsaGHcKU/mq924YdwkBHz9p+2CEMdOusVv+TA8BtPDDsEAbatuYMO4QpPXZFhh3CQD9ev/1/F99102mteCFnOleYs8WOfw4s6GtaWFULV3OYlwCnVtU/JXkK8Okku1XVGv/HxcRVkiRJD9EkqVMlqj8Gtut7vG3T1u9o4KBmvAuTbAhsDty+pnG5xlWSJKlrxlbM7DHYYmDnJI9LMgd4MbBoXJ//AZ4DkOQJwIbAT6dz2yaukiRJWi1V9SDweuAs4Brg81V1VZJ3JTm06fZXwKuTXA58FjiqprmdlUsFJEmSumbNl4muvRCqzgTOHNd2fN/51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WP0fzpIkSdI0jfRSgaqa23f+fuD9E3Tbra/PP/a1X1VVewAkORZY0vT5ObDPFHPuNtk1SZKkVeIaV62m5yX5G3qv4X8DRw03HEmSpHWbiesaara6On1gR0mSpLWtxetQZ5JrXCVJktQJVlwlSZK6xoqrJEmS1F5WXCVJkrpmRHcVsOIqSZKkTrDiKkmS1DWucZUkSZJWTZKDklyb5Prmy5gm6vOiJFcnuSrJv013TiuukiRJXTPkNa5JZgGnAM8FbgEWJ1lUVVf39dkZ+Btgv6r6RZLHTndeK66SJElaXfsC11fVDVX1APA54LBxfV4NnFJVvwCoqtunO6mJqyRJUteMjc3okWRBkiV9x4JxEWwD3Nz3+Jamrd/jgccnuSDJRUkOmu5tu1RAkiRJD1FVC4GF0xxmfWBn4JnAtsD5SXavqjunM6AkSZK6ZPj7uP4Y2K7v8bZNW79bgO9V1XLgxiTX0UtkF6/ppC4VkCRJ6poZXiqwChYDOyd5XJI5wIuBReP6fIVetZUkm9NbOnDDdG7bimsLXbbtk4YdwpSOm3/csEMY6N1L3j3sEAb6yu7vGHYIA/2s5f9CvOn+GnYIAx2cDYYdwkArMuwIBjt9w1nDDmGgR9LuGLd7cNgRDPaEunfYIWgVVdWDSV4PnAXMAj5eVVcleRewpKoWNdcOTHI1sAJ4a1X9bDrztvw/S5IkSfotLfgCgqo6EzhzXNvxfecFHNMca4VLBSRJktQJVlwlSZK6ptq/VGomWHGVJElSJ1hxlSRJ6poWrHEdBiuukiRJ6gQrrpIkSV1jxVWSJElqLyuukiRJXTP8r3wdCiuukiRJ6gQrrpIkSV3jGldJkiSpvay4SpIkdY3fnCVJkiS1lxVXSZKkrnGNqyRJktReJq7jJNkhyZVr8Lzv9j3/pWs/MkmSpMbY2MweLWXiOk1J1geoqqc2TTsAJq6
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"corrmat = df.corr()\n",
"f, ax = plt.subplots(figsize=(12, 9))\n",
"sns.heatmap(corrmat, vmax=.8, square=True);"
]
},
{
"source": [
"Are the genres significantly different in the perception of their danceability, based on their popularity? Examine our top three genres data distribution for popularity and danceability along a given x and y axis "
],
"cell_type": "code",
"metadata": {},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
4 years ago
"execution_count": 11,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/cbook/__init__.py:1402: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n x[:, None]\n/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/axes/_base.py:276: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n x = x[:, np.newaxis]\n/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/axes/_base.py:278: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n y = y[:, np.newaxis]\n/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/cbook/__init__.py:1402: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n x[:, None]\n/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/axes/_base.py:276: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n x = x[:, np.newaxis]\n/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/axes/_base.py:278: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n y = y[:, np.newaxis]\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 432x432 with 3 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"421.607969pt\" version=\"1.1\" viewBox=\"0 0 421.338125 421.607969\" width=\"421.338125pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 421.607969 \nL 421.338125 421.607969 \nL 421.338125 0 \nL 0 0 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 47.105 379.733125 \nL 351.218161 379.733125 \nL 351.218161 71.062821 \nL 47.105 71.062821 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 6 \n\" id=\"m6b051546cd\" style=\"stroke:#262626;stroke-width:1.25;\"/>\n </defs>\n <g>\n <use style=\"fill:#262626;stroke:#262626;stroke-width:1.25;\" x=\"81.537287\" xlink:href=\"#m6b051546cd\" y=\"379.733125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 20 -->\n <defs>\n <path d=\"M 52.828125 31.203125 \nL 5.5625 31.203125 \nL 5.5625 39.40625 \nL 52.828125 39.40625 \nz\n\" id=\"ArialMT-8722\"/>\n <path d=\"M 50.34375 8.453125 \nL 50.34375 0 \nL 3.03125 0 \nQ 2.9375 3.171875 4.046875 6.109375 \nQ 5.859375 10.9375 9.828125 15.625 \nQ 13.8125 20.3125 21.34375 26.46875 \nQ 33.015625 36.03125 37.109375 41.625 \nQ 41.21875 47.21875 41.21875 52.203125 \nQ 41.21875 57.421875 37.46875 61 \nQ 33.734375 64.59375 27.734375 64.59375 \nQ 21.390625 64.59375 17.578125 60.78125 \nQ 13.765625 56.984375 13.71875 50.25 \nL 4.6875 51.171875 \nQ 5.609375 61.28125 11.65625 66.578125 \nQ 17.71875 71.875 27.9375 71.875 \nQ 38.234375 71.875 44.234375 66.15625 \nQ 50.25 60.453125 50.25 52 \nQ 50.25 47.703125 48.484375 43.546875 \nQ 46.734375 39.40625 42.65625 34.8125 \nQ 38.578125 30.21875 29.109375 22.21875 \nQ 21.1875 15.578125 18.9375 13.203125 \nQ 16.703125 10.84375 15.234375 8.453125 \nz\n\" id=\"ArialMT-50\"/>\n <path d=\"M 4.15625 35.296875 \nQ 4.15625 48 6.765625 55.734375 \nQ 9.375 63.484375 14.515625 67.671875 \nQ 19.671875 71.875 27.484375 71.875 \nQ 33.25 71.875 37.59375 69.546875 \nQ 41.9375 67.234375 44.765625 62.859375 \nQ 47.609375 58.5 49.21875 52.21875 \nQ 50.828125 45.953125 50.828125 35.296875 \nQ 50.828125 22.703125 48.234375 14.96875 \nQ 45.65625 7.234375 40.5 3 \nQ 35.359375 -1.21875 27.484375 -1.21875 \nQ 17.140625 -1.21875 11.234375 6.203125 \nQ 4.15625 15.140625 4.15625 35.296875 \nz\nM 13.1875 35.296875 \nQ 13.1875 17.671875 17.3125 11.828125 \nQ 21.4375 6 27.484375 6 \nQ 33.546875 6 37.671875 11.859375 \nQ 41.796875 17.71875 41.796875 35.296875 \nQ 41.796875 52.984375 37.671875 58.78125 \nQ 33.546875 64.59375 27.390625 64.59375 \nQ 21.34375 64.59375 17.71875 59.46875 \nQ 13.1875 52.9375 13.1875 35.296875 \nz\n\" id=\"ArialMT-48\"/>\n </defs>\n <g style=\"fill:#262626;\" transform=\"translate(72.207912 397.106719)scale(0.11 -0.11)\">\n <use xlink:href=\"#ArialMT-8722\"/>\n <use x=\"58.398438\" xlink:href=\"#ArialMT-50\"/>\n <use x=\"114.013672\" xlink:href=\"#ArialMT-48\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_2\">\n <g>\n <use style=\"fill:#262626;stroke:#262626;stroke-width:1.25;\" x=\"124.309757\" xlink:href=\"#m6b051546cd\" y=\"379.733125\"/>\n </g>\n </g>\n <g id=\"text_2\">\n <!-- 0 -->\n <g style=\"fill:#262626;\" transform=\"translate(121.251242 397.106719)scale(0.11 -0.11)\">\n <use xlink:href=\"#ArialMT-48\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_3\">\n <g id=\"line2d_3\">\n <g>\n <use style=\"fill:#262626;stroke:#262626;stroke-width:1.25;\" x=\"167.082228\" xlink:href=\"#m6b051546
4 years ago
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkCAYAAAB+TFE1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nOzdeXxU1d348c+9sy+ZmewLCRD2NaCIgoAIWi3WFVq1YkVt1brUPm1BbEstVbHW2t+joLVqfbpYd3BfqgiKiqi4sUiAQMi+ZzIzmX3m3vv7Y5IhkR0SsnDer9e87p17z9z5zkDud849554jaZqmIQiCIAg9TO7pAARBEAQBREISBEEQegmRkARBEIReQSQkQRAEoVcQCUkQBEHoFURCEgRBEHoFkZAEQRCEXkHf0wEIwpFQVZWwEiEcjxCJRwnHI4Tj4Q7rex/t2yLxCLIsY9GbsRttZNrSyLJlMMg1AIPO0NMfSRCENiIhCT1KVVUag83UtjZQ29pAS9iLPxLAF/XTGgngj/j3JhklSkyJHfaxJSRMeiMmvQlVVQjHI8TUeHK/XtZTmFrASbnjOL3gZPIcOd3xEQVBOEySGKlBOJ48YR/bG3exo6mUnU272eOpIt4hSciSTIrJTorRRorJjt1oxaI3Y9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SHxSMhrjng4fY5S7jf6b+mCkFJx/2a1VVo7zOx/YyNzsrPOysbKGyvpX2/wU2s5787BTys+zkpNvIcJpJc1pId5px2kzJRHQ4XYg1TSPWoTYSiSVOyMll+yMW77y9rSwaaG3HSSwT6zpZwqDXdap9dFzvmEyMerlTDc2g71xr0+uk494
},
"metadata": {}
}
],
"source": [
"sns.set_theme(style=\"ticks\")\n",
"\n",
"# Show the joint distribution using kernel density estimation\n",
"g = sns.jointplot(\n",
" data=df,\n",
4 years ago
" x=\"popularity\", y=\"danceability\", hue=\"artist_top_genre\",\n",
" kind=\"kde\",\n",
")"
]
},
{
"source": [
"In general, the three genres align in terms of their popularity and danceability. A scatterplot of the same axes shows a similar pattern of convergence. Try a scatterplot to check the distribution of data per genre"
],
"cell_type": "code",
"metadata": {},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/seaborn/axisgrid.py:316: UserWarning: The `size` parameter has been renamed to `height`; please update your code.\n warnings.warn(msg, UserWarning)\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<seaborn.axisgrid.FacetGrid at 0x7fc69984fa20>"
]
},
"metadata": {},
"execution_count": 13
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 468.975x360 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"349.607969pt\" version=\"1.1\" viewBox=\"0 0 450.030211 349.607969\" width=\"450.030211pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 349.607969 \nL 450.030211 349.607969 \nL 450.030211 0 \nL 0 0 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 47.105 307.733125 \nL 334.665461 307.733125 \nL 334.665461 7.2 \nL 47.105 7.2 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 6 \n\" id=\"md3006d1cea\" style=\"stroke:#262626;stroke-width:1.25;\"/>\n </defs>\n <g>\n <use style=\"fill:#262626;stroke:#262626;stroke-width:1.25;\" x=\"59.267992\" xlink:href=\"#md3006d1cea\" y=\"307.733125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <defs>\n <path d=\"M 4.15625 35.296875 \nQ 4.15625 48 6.765625 55.734375 \nQ 9.375 63.484375 14.515625 67.671875 \nQ 19.671875 71.875 27.484375 71.875 \nQ 33.25 71.875 37.59375 69.546875 \nQ 41.9375 67.234375 44.765625 62.859375 \nQ 47.609375 58.5 49.21875 52.21875 \nQ 50.828125 45.953125 50.828125 35.296875 \nQ 50.828125 22.703125 48.234375 14.96875 \nQ 45.65625 7.234375 40.5 3 \nQ 35.359375 -1.21875 27.484375 -1.21875 \nQ 17.140625 -1.21875 11.234375 6.203125 \nQ 4.15625 15.140625 4.15625 35.296875 \nz\nM 13.1875 35.296875 \nQ 13.1875 17.671875 17.3125 11.828125 \nQ 21.4375 6 27.484375 6 \nQ 33.546875 6 37.671875 11.859375 \nQ 41.796875 17.71875 41.796875 35.296875 \nQ 41.796875 52.984375 37.671875 58.78125 \nQ 33.546875 64.59375 27.390625 64.59375 \nQ 21.34375 64.59375 17.71875 59.46875 \nQ 13.1875 52.9375 13.1875 35.296875 \nz\n\" id=\"ArialMT-48\"/>\n </defs>\n <g style=\"fill:#262626;\" transform=\"translate(56.209476 325.106719)scale(0.11 -0.11)\">\n <use xlink:href=\"#ArialMT-48\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_2\">\n <g>\n <use style=\"fill:#262626;stroke:#262626;stroke-width:1.25;\" x=\"130.412445\" xlink:href=\"#md3006d1cea\" y=\"307.733125\"/>\n </g>\n </g>\n <g id=\"text_2\">\n <!-- 20 -->\n <defs>\n <path d=\"M 50.34375 8.453125 \nL 50.34375 0 \nL 3.03125 0 \nQ 2.9375 3.171875 4.046875 6.109375 \nQ 5.859375 10.9375 9.828125 15.625 \nQ 13.8125 20.3125 21.34375 26.46875 \nQ 33.015625 36.03125 37.109375 41.625 \nQ 41.21875 47.21875 41.21875 52.203125 \nQ 41.21875 57.421875 37.46875 61 \nQ 33.734375 64.59375 27.734375 64.59375 \nQ 21.390625 64.59375 17.578125 60.78125 \nQ 13.765625 56.984375 13.71875 50.25 \nL 4.6875 51.171875 \nQ 5.609375 61.28125 11.65625 66.578125 \nQ 17.71875 71.875 27.9375 71.875 \nQ 38.234375 71.875 44.234375 66.15625 \nQ 50.25 60.453125 50.25 52 \nQ 50.25 47.703125 48.484375 43.546875 \nQ 46.734375 39.40625 42.65625 34.8125 \nQ 38.578125 30.21875 29.109375 22.21875 \nQ 21.1875 15.578125 18.9375 13.203125 \nQ 16.703125 10.84375 15.234375 8.453125 \nz\n\" id=\"ArialMT-50\"/>\n </defs>\n <g style=\"fill:#262626;\" transform=\"translate(124.295414 325.106719)scale(0.11 -0.11)\">\n <use xlink:href=\"#ArialMT-50\"/>\n <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_3\">\n <g id=\"line2d_3\">\n <g>\n <use style=\"fill:#262626;stroke:#262626;stroke-width:1.25;\" x=\"201.556898\" xlink:href=\"#md3006d1cea\" y=\"307.733125\"/>\n </g>\n </g>\n <g id=\"text_3\">\n <!-- 40 -->\n <defs>\n <path d=\"M 32.328125 0 \nL 32.328125 17.140625 \nL 1.265625 17.14062
4 years ago
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcEAAAFcCAYAAACwQwV1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nOzdeXgUVdY/8G+lOzuEBJKAGEQ2AYUwIktkDyAxQGRTtmAABRXkxZcZkSjCj2GbUXRQieKGDDARghAJEcGwGPZFUMEw8IKgEJQkhCQ2hCy91O+P2E0vVdVV3VW9pM7neXweu9LL7UqoU/fec89lWJZlQQghhKhQgLcbQAghhHgLBUFCCCGqRUGQEEKIalEQJIQQoloUBAkhhKiWXwZBg8GAa9euwWAweLsphBBC/JhfBsGioiIMGjQIRUVF3m4KIYQQP+aXQZAQQgiRAwVBQgghqkVBkBBCiGpRECSEEKJaFAQJIYSoFgVBQgghqkVBkBBCiGpRECSEEKJaFAQJIYSoFgVBQgghqkVBkBBCiGpRECSEEKJaFAQJIYSoltbbDSCE+Ib8U4VYv/McSsurEB0VirTkjhjwSAtvN4sQRVEQJIQg/1QhMr44jRq9EQBwo7wKGV+cBgAKhKReo+FQQgjW7zxnCYBmNXoj1u8856UWEeIZFAQJISgtr5J0nJD6goIgIQTRUaGSjhNSX9CcIFGVg1dOYOOZHNy8U4YmYY0xIX4E+rbs4e1meV1ackebOUEACA7UIC25oxdbRYjyKAgS1Th45QQ++i4TtcZaAEDpnTJ89F0mAKg+EJqTXyg7lKgNBUGiGhvP5FgCoFmtsRYbz+SoPggCdYGQgh5RGwqCxGfJPXR5806ZpOOEkPqPgqDCaA7KNUoMXTYJa4xSjoDXJKyx6w0ltMie+DXKDlWQ+UJeeqcMLO5eyA9eOeHtpvk8oaFLV02IH4EgTZD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tWsfeIRdX2iq1dydHUofSRan9adG5mOFo+yxZriFudxKjPIF6qUQuqg6Cz/Ydgow9BrD3nAcTVF2XsHK9A54dPES2z1A6ocLZBdrTF+/6uDbNnUXnni53J6Z3ap2YxTfE7WpilCdQL5XISdVBsO4fzFCs39lKkTtKTyRUOLtAy1UxpL5kR7rC1cDujXJ3QsPRAKBltNCUdUItIPj37mpilCf4ei+V+BdVB0HA9aE0MUHBEwkVYi7Q7gYvKcHcG5mUngjQQsO2fENz3ih3x3VTZCY24xZwPTHKE3y5l0r8j+qDoCvEXug9lVAhdIGWY85NSjCXGvjdDWDeXr4gNDR3nxfK3ck1HO1qYpQn+HIvlfgfCoIuEHuh5x2a0ofiib/l+NSFBZBnvaGU58oRwLy9fEFoaG5RI+fl7ly9CfDEbhhKJxy5ypd7qcT/UBB0gdgL/V8a9MHuWzvAaO7+Y2WNAai90g4sfGtCXyggScmOlPJcOQKYs9+F0kOlQkNzUSOFy925ehPg7d6vt/lyL5X4HwqCLhB7oT92WAM98xC0LS5Ysk8NhQ/YrNHylQl9oYAkJTtSynPlGC4W+l1IDRauBEyhoTln5e5cvQnwdu/XF/hqL5X4H9UFQTl6BmIv9KXlVWDR3CbocTH3Jry5e7xQQJIyzyTluVJ6jXy/N6HfhZRg4WrvytnQnFC5O1dvAvxp8T4hvk5VQVCu/f3EXuj5egn2oqNCvb57vLOAJGWeSexzxd5MiAlQXL+LVcfWcn4u1/d0tXflztCcq4vw/WnxPiG+TlVBkOtC58r+foC4Cz1XL8GeuddQ/u1Sh3T670OAb858jj/OblR8bZ6ndiG379ENuD8B318vcGupCd/vItLIokLjWCMu0sg6HHOnd+Xq0Jyr59zZ6/xpTac/tZXUT6oKgny
},
"metadata": {}
}
],
"source": [
"sns.FacetGrid(df, hue=\"artist_top_genre\", size=5) \\\n",
4 years ago
" .map(plt.scatter, \"popularity\", \"danceability\") \\\n",
" .add_legend()"
]
4 years ago
}
]
}