listening-analysis/artist.ipynb

364 lines
657 KiB
Plaintext
Raw Normal View History

2021-02-01 21:43:27 +00:00
{
"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.8.6-final"
2021-02-01 21:43:27 +00:00
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"source": [
"# Artist Investigations"
2021-02-01 21:43:27 +00:00
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 51,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
2021-02-04 13:34:25 +00:00
"538 scrobbles\n1 days spent listening since Nov. 2017\n1.52 minutes/day\n"
2021-02-01 21:43:27 +00:00
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
" acousticness danceability duration_ms energy instrumentalness \\\n",
2021-02-04 13:34:25 +00:00
"mean 0.175862 0.548939 201665.648752 0.672660 0.139468 \n",
"std 0.185824 0.118423 68133.871857 0.136468 0.280774 \n",
"min 0.001230 0.174000 33568.000000 0.330000 0.000000 \n",
"25% 0.035800 0.475000 147430.000000 0.551000 0.000114 \n",
"50% 0.093700 0.548000 203882.000000 0.683000 0.001660 \n",
"75% 0.278000 0.599000 250200.000000 0.761000 0.089300 \n",
"max 0.884000 0.825000 626166.000000 0.910000 0.914000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" key liveness loudness mode speechiness tempo \\\n",
2021-02-04 13:34:25 +00:00
"mean 5.715931 0.261474 -5.605276 0.573896 0.151126 110.033599 \n",
"std 3.886356 0.215839 2.190490 0.494984 0.141012 27.453952 \n",
"min 0.000000 0.059200 -14.841000 0.000000 0.028200 51.466000 \n",
"25% 2.000000 0.095200 -6.829000 0.000000 0.049600 86.711000 \n",
"50% 6.000000 0.171000 -5.219000 1.000000 0.087700 109.862000 \n",
"75% 9.000000 0.356000 -4.477000 1.000000 0.255000 133.687000 \n",
"max 11.000000 0.783000 -0.507000 1.000000 0.518000 168.266000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" time_signature valence \n",
2021-02-04 13:34:25 +00:00
"mean 3.990403 0.301708 \n",
"std 0.394559 0.169343 \n",
"min 1.000000 0.055700 \n",
"25% 4.000000 0.188000 \n",
"50% 4.000000 0.263000 \n",
"75% 4.000000 0.431000 \n",
"max 5.000000 0.718000 "
2021-02-01 21:43:27 +00:00
],
2021-02-04 13:34:25 +00:00
"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>acousticness</th>\n <th>danceability</th>\n <th>duration_ms</th>\n <th>energy</th>\n <th>instrumentalness</th>\n <th>key</th>\n <th>liveness</th>\n <th>loudness</th>\n <th>mode</th>\n <th>speechiness</th>\n <th>tempo</th>\n <th>time_signature</th>\n <th>valence</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>mean</th>\n <td>0.175862</td>\n <td>0.548939</td>\n <td>201665.648752</td>\n <td>0.672660</td>\n <td>0.139468</td>\n <td>5.715931</td>\n <td>0.261474</td>\n <td>-5.605276</td>\n <td>0.573896</td>\n <td>0.151126</td>\n <td>110.033599</td>\n <td>3.990403</td>\n <td>0.301708</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.185824</td>\n <td>0.118423</td>\n <td>68133.871857</td>\n <td>0.136468</td>\n <td>0.280774</td>\n <td>3.886356</td>\n <td>0.215839</td>\n <td>2.190490</td>\n <td>0.494984</td>\n <td>0.141012</td>\n <td>27.453952</td>\n <td>0.394559</td>\n <td>0.169343</td>\n </tr>\n <tr>\n <th>min</th>\n <td>0.001230</td>\n <td>0.174000</td>\n <td>33568.000000</td>\n <td>0.330000</td>\n <td>0.000000</td>\n <td>0.000000</td>\n <td>0.059200</td>\n <td>-14.841000</td>\n <td>0.000000</td>\n <td>0.028200</td>\n <td>51.466000</td>\n <td>1.000000</td>\n <td>0.055700</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>0.035800</td>\n <td>0.475000</td>\n <td>147430.000000</td>\n <td>0.551000</td>\n <td>0.000114</td>\n <td>2.000000</td>\n <td>0.095200</td>\n <td>-6.829000</td>\n <td>0.000000</td>\n <td>0.049600</td>\n <td>86.711000</td>\n <td>4.000000</td>\n <td>0.188000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>0.093700</td>\n <td>0.548000</td>\n <td>203882.000000</td>\n <td>0.683000</td>\n <td>0.001660</td>\n <td>6.000000</td>\n <td>0.171000</td>\n <td>-5.219000</td>\n <td>1.000000</td>\n <td>0.087700</td>\n <td>109.862000</td>\n <td>4.000000</td>\n <td>0.263000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>0.278000</td>\n <td>0.599000</td>\n <td>250200.000000</td>\n <td>0.761000</td>\n <td>0.089300</td>\n <td>9.000000</td>\n <td>0.356000</td>\n <td>-4.477000</td>\n <td>1.000000</td>\n <td>0.255000</td>\n <td>133.687000</td>\n <td>4.000000</td>\n <td>0.431000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>0.884000</td>\n <td>0.825000</td>\n <td>626166.000000</td>\n <td>0.910000</td>\n <td>0.914000</td>\n <td>11.000000</td>\n <td>0.783000</td>\n <td>-0.507000</td>\n <td>1.000000</td>\n <td>0.518000</td>\n <td>168.266000</td>\n <td>5.000000</td>\n <td>0.718000</td>\n </tr>\n </tbody>\n</table>\n</div>"
2021-02-01 21:43:27 +00:00
},
"metadata": {},
2021-02-04 13:34:25 +00:00
"execution_count": 51
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-02-04 13:34:25 +00:00
"artist_name = \"Flume\".lower()\n",
"artist_frame = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name] # FILTER SCROBBLES\n",
2021-02-01 21:43:27 +00:00
"artist_frame = artist_frame.sort_index(ascending=False) # SORT\n",
"# artist_frame = artist_frame.loc[:, descriptor_headers] # DESCRIPTORS\n",
"\n",
"total_time = artist_frame[\"duration_ms\"].sum() / (1000 * 60) # minutes\n",
"total_days = total_time / (60 * 24) # days\n",
"print(f'{artist_frame.count()[0]:,d} scrobbles')\n",
"print(f'{total_days:.0f} days spent listening since Nov. 2017')\n",
"print(f'{total_time / days_since(first_day).days:.2f} minutes/day')\n",
"\n",
"artist_frame.describe()[1:]"
]
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 52,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x480 with 1 Axes>",
2021-02-04 13:34:25 +00:00
"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=\"288.512187pt\" version=\"1.1\" viewBox=\"0 0 368.925 288.512187\" width=\"368.925pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <metadata>\n <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <cc:Work>\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n <dc:date>2021-02-04T10:03:42.304318</dc:date>\n <dc:format>image/svg+xml</dc:format>\n <dc:creator>\n <cc:Agent>\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\n </cc:Agent>\n </dc:creator>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs>\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M -0 288.512187 \nL 368.925 288.512187 \nL 368.925 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 26.925 239.758125 \nL 361.725 239.758125 \nL 361.725 22.318125 \nL 26.925 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <path clip-path=\"url(#p84e06626fe)\" d=\"M 26.925 239.758125 \nL 26.925 22.318125 \n\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n </g>\n <g id=\"line2d_2\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"mab53af8feb\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.925\" xlink:href=\"#mab53af8feb\" y=\"239.758125\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_3\">\n <path clip-path=\"url(#p84e06626fe)\" d=\"M 41.757911 239.758125 \nL 41.757911 22.318125 \n\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n </g>\n <g id=\"line2d_4\">\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"41.757911\" xlink:href=\"#mab53af8feb\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(34.050099 254.356562)scale(0.1 -0.1)\">\n <defs>\n <path d=\"M 9.8125 72.90625 \nL 19.671875 72.90625 \nL 19.671875 5.078125 \nQ 19.671875 -8.109375 14.671875 -14.0625 \nQ 9.671875 -20.015625 -1.421875 -20.015625 \nL -5.171875 -20.015625 \nL -5.171875 -11.71875 \nL -2.09375 -11.71875 \nQ 4.4375 -11.71875 7.125 -8.046875 \nQ 9.8125 -4.390625 9.8125 5.078125 \nz\n\" id=\"DejaVuSans-74\"/>\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 54.890625 33.015625 \nL 54.890625 0 \nL 45.90625 0 \nL 45.90625 32.71875 \nQ 45.90625 40.484375 42.875 44.328125 \nQ 39.84375 48.1875 33.796875 48.
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAHmCAYAAADZdELPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWX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GFGCCGEEBIQKMwIIYQQQgIChRkhhBBCSEBoOINZezzKNbDMH+N13h1CCCGEkEK0wppFfJ9SarDYyg0nzGCJsrvqvROEEEIIISXwCgC/KLZSIwqzgwDw4x//GJdccklVNjAyMoL169dj9erV6O7urso2CKkHPLZJM8PjmwSRzZs343Wvex1g65diNKIwiwPAokWLsGzZsqpsYGhoCEePHsXSpUvR29tblW0QUg94bJNmhsc3CSIjIyP6R0/lVyz+J4QQQggJCBRmhBBCCCEBgcKMEEIIISQgUJgRQgghhAQECjNCCCGEkIBAYUYIIYQQEhAozAghhBBCAgKFGSGEEEJIQKAwI4QQQggJCBRmhBBCCCEBgcKMEEIIISQgUJgRQgghhAQECjNCCCmBaGICTx4cQCql6r0rhJAmhMKMEEJK4L0/eQKv+NpD+J8H9tR7VwghTQiFGSGElMDWw4MAgM32d0II8RMKM0IIKYH4RAoAEEtM1HlPCCHNCIUZIYSUQCxpCbNxCjNCSBWgMCOEkBKIa2EWpzAjhPgPhRkhhHhEKeVEzKKJVJ33hhDSjFCYEUKIRxITaYuMKFOZhJAqQGFGCCEe0YX/AGvMCCHVgcKMEEI8ouvLAEbMCCHVgcKMEEI8YgozRswIIdWAwowQQjySGTFLcSwTIcR3KMwIIcQj8YnMKFksyc5MQoi/UJg
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
2021-02-01 21:43:27 +00:00
"# resample by day and mean\n",
"filtered_artist = filtered_artist.resample(\"2W\").count()\n",
2021-02-01 21:43:27 +00:00
"\n",
"filtered_artist[\"energy\"].plot()\n",
"\n",
"plt.title(f\"{artist_name} Scrobbles\")\n",
"plt.grid()\n",
"plt.show()"
]
},
2021-02-04 13:34:25 +00:00
{
"source": [
"## Average Descriptor\n",
"\n",
"Below presents the average descriptor for the artist. \"*All Listened Tracks*\" describes the descriptor based on the listening activity for this artist. This takes into account how many times a track is listened to. \"*Distinct Tracks*\" takes only the distinct set of tracks that have been listened to and takes that average.\n",
"\n",
"The difference between them could be described as which features are preferred for an artist. If the blue bar is higher than the red, it would indicate that tracks from this artist which have a higher value for this are listened to more. "
],
"cell_type": "markdown",
"metadata": {}
},
2021-02-01 21:43:27 +00:00
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 53,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x480 with 1 Axes>",
2021-02-04 13:34:25 +00:00
"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=\"263.63625pt\" version=\"1.1\" viewBox=\"0 0 372.103125 263.63625\" width=\"372.103125pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <metadata>\n <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <cc:Work>\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n <dc:date>2021-02-04T10:03:43.059576</dc:date>\n <dc:format>image/svg+xml</dc:format>\n <dc:creator>\n <cc:Agent>\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\n </cc:Agent>\n </dc:creator>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs>\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 263.63625 \nL 372.103125 263.63625 \nL 372.103125 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 30.103125 239.758125 \nL 364.903125 239.758125 \nL 364.903125 22.318125 \nL 30.103125 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 45.321307 239.758125 \nL 61.2209 239.758125 \nL 61.2209 196.456847 \nL 45.321307 196.456847 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 90.748715 239.758125 \nL 106.648308 239.758125 \nL 106.648308 117.681096 \nL 90.748715 117.681096 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 136.176124 239.758125 \nL 152.075717 239.758125 \nL 152.075717 95.871519 \nL 136.176124 95.871519 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 181.603532 239.758125 \nL 197.503125 239.758125 \nL 197.503125 203.762859 \nL 181.603532 203.762859 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 227.03094 239.758125 \nL 242.930533 239.758125 \nL 242.930533 186.446669 \nL 227.03094 186.446669 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 272.458349 239.758125 \nL 288.357942 239.758125 \nL 288.357942 208.269016 \nL 272.458349 208.269016 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 317.885757 239.758125 \nL 333.78535 239.758125 \nL 333.78535 168.173426 \nL 317.885757 168.173426 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 61.2209 239.758125 \nL 77.120493 239.758125 \nL 77.120493 201.518651 \nL 61.2209 201.518651 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 106.648308 239.758125 \nL 122.547901 239.758125 \nL 122.547901 120.39692 \nL 106.648308 120.39692 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 152.075717 239.758125 \nL 167.97531 239.758125 \nL 167.97531 93.494876 \nL 152.075717 93.494876 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_13\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 197.503125 239.758125 \nL 213.402718 239.758125 \nL 213.402718 209.432133 \nL 197.503125 209.432133 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_14\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 242.930533 239.758125 \nL 258.830126 239.758125 \nL 258.830126 182.903199 \nL 242.930533 182.903199 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_15\">\n <path clip-path=\"url(#p90e11885db)\" d=\"M 288.357942 239.758125 \nL
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAG5CAYAAAAzjmgkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AABM3klEQVR4nO3deXxU1f3/8dcnLAEMm4IsIoLgggiiKCgFRVCRstQFi2tFq2D50cq3rXUBMWCtaC2tUlGpC4pYRFRc2RRxreBXyxdRXAAjKiAoazSCkPP749yJN5NJMpkkk0t4Px+PeUxy7jnnnntyZ+aTc869Y845RERERCS6Mqq6ASIiIiJSMgVsIiIiIhGngE1EREQk4hSwiYiIiEScAjYRERGRiFPAJiIiIhJxCthEREREIk4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w2U5B/4wOwNM5uFD8aOD9o4G39vu3AbtpvZ/8Ov0XsrKBO7D9sx+AXxp/DTVHdF9nFYm9CFA7XwAVrX4AHwKHBVXNvL2n+nA381s9jVvBvxF6z8Iji+v4bqXmBmf8YHrSvNbA7+PmzN8H35Nj8F4+X1HPC0mT2Nv1VKF/x92Tbjz5+wl/FrB/9lZk8CO4Ctzrl/OuecmV2KPw8fN7Nn8LfxOAI/ergD+JVzLh+RvUVV31dEDz32lgdlvA9bkH4w8Dj+AycPf3+1cyjlPmzF7GMaxd93KjvY1jvBtk5B2c/x9xjbjL8P2X1An1KOOQNYG9TduZS89fCjPLuAA0PpPfnpHluTS6mjDX7U6lP8zWu34z9opwNnJdsfoTwD8QHFjqBtC/BXjA4Lyg5LUKY//ma73+NHFZ/BB1zPB2UaVWQfh+qInRPhRx4+aHwNH0R
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
"filtered_artist_no_dup = filtered_artist.drop_duplicates(['uri'])\n",
"\n",
"filtered_artist_no_dup = filtered_artist_no_dup.loc[:, float_headers].mean()\n",
"filtered_artist_dup = filtered_artist.loc[:, float_headers].mean()\n",
"\n",
"x = np.arange(len(float_headers))\n",
"width = 0.35\n",
"plt.bar(x - width/2, filtered_artist_no_dup, width, label='All Listened Tracks')\n",
"plt.bar(x + width/2, filtered_artist_dup, width, label='Distinct Tracks', color=(1, 0, 0))\n",
"\n",
"plt.title(f\"{artist_name} Average Descriptor\")\n",
"plt.legend(['All Listened Tracks', 'Distinct Tracks'])\n",
"plt.xticks(x, labels=[i[:6] for i in float_headers])\n",
"plt.ylim([0, 1])\n",
"plt.grid(axis='y')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x480 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=\"288.512187pt\" version=\"1.1\" viewBox=\"0 0 372.103125 288.512187\" width=\"372.103125pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <metadata>\n <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <cc:Work>\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n <dc:date>2021-02-04T10:04:26.738451</dc:date>\n <dc:format>image/svg+xml</dc:format>\n <dc:creator>\n <cc:Agent>\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\n </cc:Agent>\n </dc:creator>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs>\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 288.512187 \nL 372.103125 288.512187 \nL 372.103125 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 30.103125 239.758125 \nL 364.903125 239.758125 \nL 364.903125 22.318125 \nL 30.103125 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <path clip-path=\"url(#pa4f821c720)\" d=\"M 48.703125 239.758125 \nL 48.703125 22.318125 \n\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n </g>\n <g id=\"line2d_2\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"ma99c74aed6\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"48.703125\" xlink:href=\"#ma99c74aed6\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(40.995312 254.356562)scale(0.1 -0.1)\">\n <defs>\n <path d=\"M 9.8125 72.90625 \nL 19.671875 72.90625 \nL 19.671875 5.078125 \nQ 19.671875 -8.109375 14.671875 -14.0625 \nQ 9.671875 -20.015625 -1.421875 -20.015625 \nL -5.171875 -20.015625 \nL -5.171875 -11.71875 \nL -2.09375 -11.71875 \nQ 4.4375 -11.71875 7.125 -8.046875 \nQ 9.8125 -4.390625 9.8125 5.078125 \nz\n\" id=\"DejaVuSans-74\"/>\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 54.890625 33.015625 \nL 54.890625 0 \nL 45.90625 0 \nL 45.90625 32.71875 \nQ 45.90625 40.484375 42.875 44.328125 \nQ 39.84375 48.1875 33.796875 48.1875 \nQ 26.515625 48.1875 22.3125 43.546875 \nQ 18.109375 38.921875 18.109375 30.90625 \nL 18.109375 0 \nL 9.078125 0 \nL 9.078125 54.6875 \nL 18.109375 54.6875 \nL 18.109375 46.1875 \nQ 21.34375 51.125 25.703125 53.5625 \nQ 30.078125 56 35.796875 56 \nQ 45.21875 56 50.046875 50.171875 \nQ 54.890625 44.34375 54.890625 33.015625 \nz\n\" id=\"DejaVuSans-110\"/>\n </defs>\n <use xlink
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAHmCAYAAADOVtIGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOydZ3gUVduA77Ob3uiQ0HvvvQkEaTaqCDaKCqJixRf11U9A9LWhYgFEBLGDKAoKIl2UFlroIAIBQuiQ3nfn+3E2Ibszm2zKpp77unIleebMmbO7szPPPFVomoZCoVAoFAqFovhiKuoFKBQKhUKhUCiyRylsCoVCoVAoFMUcpbApFAqFQqFQFHOUwqZQKBQKhUJRzFEKm0KhUCgUCkUxRylsCoVCoVAoFMUcpbApFAqFQqFQFHOUwqZQKBQKhUJRzFEKm0KhUCgUCkUxRylsCoVCoVAoFMUcpbApFAqFQqFQFHOUwqYoEQghnhJCHBFCJAkhNCHEMza5JoTYXLSrK34IIcbZ3ptxRb2W0oQQIkIIEeGmuevaPrPF7phfkTvUd0hR3FAKm6LYI4QYDXwIJAOzgRnAjqJcU1EghOgvhPhWCHFaCJFoU17/FUJ8LYS4rajXV9gIIabbbqh9inotrlKSHjCEEDWEEO8IIfYLIWJt59spIcRiIUSnol5fbrC977n5GV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07WOktQtkVm1O/Ilcd3Vk9qchQtZiG4a0Gi1yOHYS8INtjn5Iy6MHeusayO9KBdt8ZZGy/voVuUApbIrSSEYM0oSsQiFEK2Q8lbv5BOn2+0AIoStmK2TdLlcVie+R7slGwAqbZcpovieA9/Kx5gjb755Zg6KFEAHAAvJmjc+Ys09
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
2021-02-01 21:43:27 +00:00
"# select only descriptor float columns\n",
"filtered_artist = filtered_artist.loc[:, float_headers]\n",
"# resample by day and mean\n",
"filtered_artist = filtered_artist.resample(\"1M\").mean()\n",
"\n",
"# filtered_playlist[\"energy\"].plot()\n",
2021-02-04 13:34:25 +00:00
"filtered_artist.plot(lw=3)\n",
2021-02-01 21:43:27 +00:00
"\n",
"plt.title(f\"{artist_name} Characteristics Over Time\")\n",
"plt.legend(loc = \"upper left\", fontsize = \"xx-small\")\n",
"plt.ylim([0, 1])\n",
"plt.grid()\n",
"plt.show()"
]
},
{
"source": [
"# Artist Listening Time"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [],
"source": [
"limit = 35\n",
"artists = fmnet.top_artists(period=fmnet.Range.OVERALL, limit=limit)\n",
"\n",
"filtered_artists = [scrobbles[scrobbles[\"artist\"] == i.name] for i in artists]\n",
"\n",
"### STATS ###\n",
"# total time listening to artists \n",
"artists_time = [i[\"duration_ms\"].sum() for i in filtered_artists]\n",
"# total number of tracks\n",
"artists_track_count = np.array([i.drop_duplicates([\"uri\"]).count()[0] for i in filtered_artists])\n",
"# average length of artist's tracks (ms)\n",
"artists_average_track_length = np.array([i.drop_duplicates([\"uri\"])[\"duration_ms\"].mean() for i in filtered_artists])\n",
"\n",
"fig_size = (7,(5/20)*limit)"
]
},
{
"source": [
"For these charts the ordering is left as retrieved from the API, i.e by most played."
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 49,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 840x1050 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=\"535.524375pt\" version=\"1.1\" viewBox=\"0 0 512.242188 535.524375\" width=\"512.242188pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <metadata>\n <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <cc:Work>\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n <dc:date>2021-02-03T15:58:40.650686</dc:date>\n <dc:format>image/svg+xml</dc:format>\n <dc:creator>\n <cc:Agent>\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\n </cc:Agent>\n </dc:creator>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs>\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M -0 535.524375 \nL 512.242188 535.524375 \nL 512.242188 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 114.442188 497.968125 \nL 505.042188 497.968125 \nL 505.042188 22.318125 \nL 114.442188 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 53.879018 \nL 482.416142 53.879018 \nL 482.416142 43.93858 \nL 114.442188 43.93858 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 66.304567 \nL 486.442188 66.304567 \nL 486.442188 56.364128 \nL 114.442188 56.364128 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 78.730116 \nL 436.48022 78.730116 \nL 436.48022 68.789677 \nL 114.442188 68.789677 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 91.155664 \nL 386.650119 91.155664 \nL 386.650119 81.215225 \nL 114.442188 81.215225 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 103.581213 \nL 211.859026 103.581213 \nL 211.859026 93.640774 \nL 114.442188 93.640774 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 116.006761 \nL 274.209163 116.006761 \nL 274.209163 106.066322 \nL 114.442188 106.066322 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 128.43231 \nL 317.697746 128.43231 \nL 317.697746 118.491871 \nL 114.442188 118.491871 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 140.857859 \nL 270.449894 140.857859 \nL 270.449894 130.91742 \nL 114.442188 130.91742 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 153.283407 \nL 305.891725 153.283407 \nL 305.891725 143.342968 \nL 114.442188 143.342968 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 165.708956 \nL 246.971046 165.708956 \nL 246.971046 155.768517 \nL 114.442188 155.768517 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_13\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 178.134504 \nL 235.327407 178.134504 \nL 235.327407 168.194065 \nL 114.442188 168.194065 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_14\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 190.560053 \nL 250.286501 190.560053 \nL 250.286501 180.619614 \nL 114.442188 180.619614 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_15\">\n <path clip-path=\"url(#p5e403c3952)\" d=\"M 114.442188 202
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1UAAAOACAYAAADSDFlaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AADpL0lEQVR4nOzdd5xcVf3/8dcbpAkkoSOoBAJSRfQHhN6UJgooYKEGFRBEBEQQpQTkCygooBjphIBUkd5CSUjoBgFp0kM1JIEkSyAJkHx+f5wzyc3NzO7szm5mk7yfj8c87s65557zubMT3Q+nXEUEZmZmZmZm1jHzNTsAMzMzMzOzOZmTKjMzMzMzswY4qTIzMzMzM2uAkyozMzMzM7MGOKkyMzMzMzNrgJMqMzMzMzOzBjipMjMzMzMza4CTKjMzMzMzswY4qTIzMzMzM2uAkyozMzMzM7MGOKkyMzMzMzNrgJMqM7N5iKR+kkJSv2bH0tnm5nvrKEkjJY3swHUnSZos6QsN9u/fyVxK0pGSPpG0RrNjMesOnFSZmc2h8h+r7Xn1a3bM7VX4o3zgb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/zA+rQNhDCX9bbBh+YSkH0ratsazspYHDshvh3Wg37b8jTQt8PjS/Vf6/3zh7bmkNX1nSZpl+3dJC+YpoR2W14wdRUoga33Ol+TzZxS/L5KWBo4v1CkbmI/75tenpO/e7LIHaVT3jjY2qKio/Fse0mots7mc11SZmVmnioh7Jf2a9MfmS5JuJ+0guBiwEmlU5QFgh3Y0u5mkgTXO/Tsi/lzj3NHANpIquxhOBNYmjXiMIz3LqGIIaTTqNEnr5PNExCn5/KGk9U4nA/tIeoC0lmkF0uYRG5BGLl5
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"plt.figure(figsize=fig_size)\n",
2021-02-01 21:43:27 +00:00
"plt.barh(np.arange(len(artists))[::-1], np.array(artists_time) / (1000 * 60 * 60) )\n",
"plt.yticks(np.arange(len(artists))[::-1], labels=[i.name for i in artists])\n",
"plt.xlabel(\"Time (Hours)\")\n",
"plt.grid(axis=\"x\")\n",
"plt.title(\"Time Listened (Since Nov 17)\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 840x1050 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=\"535.524375pt\" version=\"1.1\" viewBox=\"0 0 516.936215 535.524375\" width=\"516.936215pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <metadata>\n <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <cc:Work>\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n <dc:date>2021-02-03T15:58:42.189015</dc:date>\n <dc:format>image/svg+xml</dc:format>\n <dc:creator>\n <cc:Agent>\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\n </cc:Agent>\n </dc:creator>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs>\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M -0 535.524375 \nL 516.936215 535.524375 \nL 516.936215 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 114.442188 497.968125 \nL 505.042188 497.968125 \nL 505.042188 22.318125 \nL 114.442188 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 53.879018 \nL 308.316517 53.879018 \nL 308.316517 43.93858 \nL 114.442188 43.93858 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 66.304567 \nL 354.056091 66.304567 \nL 354.056091 56.364128 \nL 114.442188 56.364128 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 78.730116 \nL 348.000615 78.730116 \nL 348.000615 68.789677 \nL 114.442188 68.789677 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 91.155664 \nL 255.302103 91.155664 \nL 255.302103 81.215225 \nL 114.442188 81.215225 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 103.581213 \nL 173.254025 103.581213 \nL 173.254025 93.640774 \nL 114.442188 93.640774 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 116.006761 \nL 217.486864 116.006761 \nL 217.486864 106.066322 \nL 114.442188 106.066322 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 128.43231 \nL 178.514671 128.43231 \nL 178.514671 118.491871 \nL 114.442188 118.491871 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 140.857859 \nL 189.294592 140.857859 \nL 189.294592 130.91742 \nL 114.442188 130.91742 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 153.283407 \nL 486.442188 153.283407 \nL 486.442188 143.342968 \nL 114.442188 143.342968 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 165.708956 \nL 267.695078 165.708956 \nL 267.695078 155.768517 \nL 114.442188 155.768517 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_13\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 178.134504 \nL 237.851792 178.134504 \nL 237.851792 168.194065 \nL 114.442188 168.194065 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_14\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 190.560053 \nL 230.47473 190.560053 \nL 230.47473 180.619614 \nL 114.442188 180.619614 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_15\">\n <path clip-path=\"url(#peae25bd765)\" d=\"M 114.442188 202
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1wAAAOACAYAAAAuGXKQA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hattBvcVLFvoaQtEWeQSub7Z6yylK0z5U7R8RIUin470j6Yfl4vtYXJK3YmXjraDDpb/VUFTbZSfoscFgHx6r5vXShs/L7BZI+XT4oacm83NbMGsh7uMzMrE0R8W5+ztbvaxx/SNLvgaOBp/O+r/dJMyHrkwoOnNFV8VZxNimxekDSNaSlVhuTZi3+Qdp7NbeOBraWVKkiN5m09G4HYAKzKutBWmq4IfAT4NuS7iMVOFiRtLdrU1JS+yxARDwo6c+kmcXK91p5DtcEau+Z66w/kWZ6HiQlqx8C/w/YmlT1r1hx8F5SMZILJF0HvEcq+nBuPr4naf/cRZJ+TlrCOZE067kB6e9jE9LzoZrt96Tnin0fWEvSENI+uu8Cw/OxGe0c63nS7/b7kj4ifW8BXNZVS/gi4l5JvyIl5y9Kup30N9qD9HyyLUn/29y+K+IxW1A54TIzs/b6E+mBq72rHYyIYyQ9QXpg8r6kzfsvk/ZP/SHmfOhxl4mIOyV9O8fyPdJyr8dIzylanc4lXANJyU9fUgL3CeCN3P6H4j+uI+IjSbsAe5Oeg/Qt0j9+x5H+IXw8qUJg0S+AF4CfkopXvAPcAPwa+Hcn4m7NKcCupKT0G6Qk47XcfnZETCjc012SjgQOIM0CLUpKLs7Nx9+Q9P9ISeNupDLkC5PK4z9LmvV7qkH30SERMUXSVqQZ3d2Bw0m/l1NIM3W7MGuvV1tjTZe0K3Aa6cHESwEiJThdtmcqIk7PifPPSX+fO5P+g8ObpP8YcEVXxWK2oFLrxaHMzMz
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"plt.figure(figsize=fig_size)\n",
"plt.barh(np.arange(len(artists))[::-1], np.array(artists_time) / (artists_track_count * artists_average_track_length) )\n",
"plt.yticks(np.arange(len(artists))[::-1], labels=[i.name for i in artists])\n",
"plt.xlabel(\"Average plays per song\")\n",
"plt.grid(axis=\"x\")\n",
"plt.title(\"Normalised listening time\")\n",
2021-02-01 21:43:27 +00:00
"plt.show()"
]
},
{
"source": [
"# Imports & Setup"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 2,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime\n",
"\n",
"from google.cloud import bigquery\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"mpl.rcParams['figure.dpi'] = 120\n",
"\n",
"from analysis.net import get_spotnet, get_fmnet, get_playlist, track_frame\n",
"from analysis.query import *\n",
"from analysis import float_headers, days_since\n",
2021-02-01 21:43:27 +00:00
"\n",
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"client = bigquery.Client()\n",
"spotnet = get_spotnet()\n",
"fmnet = get_fmnet()\n",
"cache = 'query.csv'\n",
"first_day = datetime(year=2017, month=11, day=3)"
]
},
{
"source": [
"## Read Scrobble Frame"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 3,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
"scrobbles = get_query(cache=cache)"
2021-02-01 21:43:27 +00:00
]
},
{
"source": [
"## Write Scrobble Frame"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"scrobbles.reset_index().to_csv(cache, sep='\\t')"
2021-02-01 21:43:27 +00:00
]
}
]
}