listening-analysis/artist.ipynb

266 lines
421 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.4-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"source": [
"# Artist Investigations\n",
"\n",
"Similar to the playlist investigations"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"2,220 scrobbles\n5 days spent listening since Nov. 2017\n6.43 minutes/day\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
" acousticness danceability duration_ms energy instrumentalness \\\n",
"mean 0.212988 0.556427 206109.940541 0.689568 0.038141 \n",
"std 0.195843 0.145240 62979.977621 0.132678 0.159018 \n",
"min 0.000843 0.256000 48507.000000 0.176000 0.000000 \n",
"25% 0.049700 0.450000 168009.000000 0.604000 0.000000 \n",
"50% 0.161000 0.528000 201158.000000 0.668000 0.000002 \n",
"75% 0.261000 0.604000 226520.000000 0.805000 0.000648 \n",
"max 0.946000 0.948000 513707.000000 0.946000 0.901000 \n",
"\n",
" key liveness loudness mode speechiness tempo \\\n",
"mean 5.493694 0.328512 -8.165929 0.677928 0.297323 110.274670 \n",
"std 3.646806 0.184782 1.846141 0.467376 0.127891 32.589491 \n",
"min 0.000000 0.052900 -16.918000 0.000000 0.029600 56.046000 \n",
"25% 1.000000 0.161000 -9.363000 0.000000 0.203000 88.607000 \n",
"50% 6.000000 0.325000 -8.336000 1.000000 0.299000 91.973000 \n",
"75% 8.000000 0.464000 -6.832000 1.000000 0.380000 130.396000 \n",
"max 11.000000 0.796000 -2.002000 1.000000 0.749000 188.050000 \n",
"\n",
" time_signature valence \n",
"mean 3.997297 0.507103 \n",
"std 0.150085 0.194317 \n",
"min 3.000000 0.038300 \n",
"25% 4.000000 0.373000 \n",
"50% 4.000000 0.504000 \n",
"75% 4.000000 0.631000 \n",
"max 5.000000 0.959000 "
],
"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.212988</td>\n <td>0.556427</td>\n <td>206109.940541</td>\n <td>0.689568</td>\n <td>0.038141</td>\n <td>5.493694</td>\n <td>0.328512</td>\n <td>-8.165929</td>\n <td>0.677928</td>\n <td>0.297323</td>\n <td>110.274670</td>\n <td>3.997297</td>\n <td>0.507103</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.195843</td>\n <td>0.145240</td>\n <td>62979.977621</td>\n <td>0.132678</td>\n <td>0.159018</td>\n <td>3.646806</td>\n <td>0.184782</td>\n <td>1.846141</td>\n <td>0.467376</td>\n <td>0.127891</td>\n <td>32.589491</td>\n <td>0.150085</td>\n <td>0.194317</td>\n </tr>\n <tr>\n <th>min</th>\n <td>0.000843</td>\n <td>0.256000</td>\n <td>48507.000000</td>\n <td>0.176000</td>\n <td>0.000000</td>\n <td>0.000000</td>\n <td>0.052900</td>\n <td>-16.918000</td>\n <td>0.000000</td>\n <td>0.029600</td>\n <td>56.046000</td>\n <td>3.000000</td>\n <td>0.038300</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>0.049700</td>\n <td>0.450000</td>\n <td>168009.000000</td>\n <td>0.604000</td>\n <td>0.000000</td>\n <td>1.000000</td>\n <td>0.161000</td>\n <td>-9.363000</td>\n <td>0.000000</td>\n <td>0.203000</td>\n <td>88.607000</td>\n <td>4.000000</td>\n <td>0.373000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>0.161000</td>\n <td>0.528000</td>\n <td>201158.000000</td>\n <td>0.668000</td>\n <td>0.000002</td>\n <td>6.000000</td>\n <td>0.325000</td>\n <td>-8.336000</td>\n <td>1.000000</td>\n <td>0.299000</td>\n <td>91.973000</td>\n <td>4.000000</td>\n <td>0.504000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>0.261000</td>\n <td>0.604000</td>\n <td>226520.000000</td>\n <td>0.805000</td>\n <td>0.000648</td>\n <td>8.000000</td>\n <td>0.464000</td>\n <td>-6.832000</td>\n <td>1.000000</td>\n <td>0.380000</td>\n <td>130.396000</td>\n <td>4.000000</td>\n <td>0.631000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>0.946000</td>\n <td>0.948000</td>\n <td>513707.000000</td>\n <td>0.946000</td>\n <td>0.901000</td>\n <td>11.000000</td>\n <td>0.796000</td>\n <td>-2.002000</td>\n <td>1.000000</td>\n <td>0.749000</td>\n <td>188.050000</td>\n <td>5.000000</td>\n <td>0.959000</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 48
}
],
"source": [
"artist_name = \"Freddie Gibbs\"\n",
"artist_frame = scrobbles.query(f'artist == \"{artist_name}\"') # FILTER SCROBBLES\n",
"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",
"execution_count": 52,
"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\"?>\r\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n<svg height=\"288.512187pt\" version=\"1.1\" viewBox=\"0 0 388.0125 288.512187\" width=\"388.0125pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n <metadata>\r\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#\">\r\n <cc:Work>\r\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\r\n <dc:date>2021-02-01T20:15:33.312153</dc:date>\r\n <dc:format>image/svg+xml</dc:format>\r\n <dc:creator>\r\n <cc:Agent>\r\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\r\n </cc:Agent>\r\n </dc:creator>\r\n </cc:Work>\r\n </rdf:RDF>\r\n </metadata>\r\n <defs>\r\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\r\n </defs>\r\n <g id=\"figure_1\">\r\n <g id=\"patch_1\">\r\n <path d=\"M 0 288.512187 \r\nL 388.0125 288.512187 \r\nL 388.0125 0 \r\nL 0 0 \r\nz\r\n\" style=\"fill:none;\"/>\r\n </g>\r\n <g id=\"axes_1\">\r\n <g id=\"patch_2\">\r\n <path d=\"M 33.2875 239.758125 \r\nL 368.0875 239.758125 \r\nL 368.0875 22.318125 \r\nL 33.2875 22.318125 \r\nz\r\n\" style=\"fill:#ffffff;\"/>\r\n </g>\r\n <g id=\"matplotlib.axis_1\">\r\n <g id=\"xtick_1\">\r\n <g id=\"line2d_1\">\r\n <path clip-path=\"url(#p2c092960f3)\" d=\"M 33.2875 239.758125 \r\nL 33.2875 22.318125 \r\n\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\r\n </g>\r\n <g id=\"line2d_2\">\r\n <defs>\r\n <path d=\"M 0 0 \r\nL 0 3.5 \r\n\" id=\"mbfe1ad4491\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n </defs>\r\n <g>\r\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"33.2875\" xlink:href=\"#mbfe1ad4491\" y=\"239.758125\"/>\r\n </g>\r\n </g>\r\n </g>\r\n <g id=\"xtick_2\">\r\n <g id=\"line2d_3\">\r\n <path clip-path=\"url(#p2c092960f3)\" d=\"M 41.6575 239.758125 \r\nL 41.6575 22.318125 \r\n\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\r\n </g>\r\n <g id=\"line2d_4\">\r\n <g>\r\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"41.6575\" xlink:href=\"#mbfe1ad4491\" y=\"239.758125\"/>\r\n </g>\r\n </g>\r\n <g id=\"text_1\">\r\n <!-- Jan -->\r\n <g transform=\"translate(33.949688 254.356562)scale(0.1 -0.1)\">\r\n <defs>\r\n <path d=\"M 9.8125 72.90625 \r\nL 19.671875 72.90625 \r\nL 19.671875 5.078125 \r\nQ 19.671875 -8.109375 14.671875 -14.0625 \r\nQ 9.671875 -20.015625 -1.421875 -20.015625 \r\nL -5.171875 -20.015625 \r\nL -5.171875 -11.71875 \r\nL -2.09375 -11.71875 \r\nQ 4.4375 -11.71875 7.125 -8.046875 \r\nQ 9.8125 -4.390625 9.8125 5.078125 \r\nz\r\n\" id=\"DejaVuSans-74\"/>\r\n <path d=\"M 34.28125 27.484375 \r\nQ 23.390625 27.484375 19.1875 25 \r\nQ 14.984375 22.515625 14.984375 16.5 \r\nQ 14.984375 11.71875 18.140625 8.90625 \r\nQ 21.296875 6.109375 26.703125 6.109375 \r\nQ 34.1875 6.109375 38.703125 11.40625 \r\nQ 43.21875 16.703125 43.21875 25.484375 \r\nL 43.21875 27.484375 \r\nz\r\nM 52.203125 31.203125 \r\nL 52.203125 0 \r\nL 43.21875 0 \r\nL 43.21875 8.296875 \r\nQ 40.140625 3.328125 35.546875 0.953125 \r\nQ 30.953125 -1.421875 24.3125 -1.421875 \r\nQ 15.921875 -1.421875 10.953125 3.296875 \r\nQ 6 8.015625 6 15.921875 \r\nQ 6 25.140625 12.171875 29.828125 \r\nQ 18.359375 34.515625 30.609375 34.515625 \r\nL 43.21875 34.515625 \r\nL 43.21875 35.40625 \r\nQ 43.21875 41.609375 39.140625 45 \r\nQ 35.0625 48.390625 27.6875 48.390625 \r\nQ 23 48.390625 18.546875 47.265625 \r\nQ 14.109375 46.140625 10.015625 43.890625 \r\nL 10.015625 52.203125 \r\nQ 14.9375 54.109375 19.578125 55.046875 \r\nQ 24.21875 56 28.609375 56 \r\nQ 40.484375 56 46.34375 49.84375 \r\nQ 52.20312
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoYAAAHmCAYAAADulk++AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAC3l0lEQVR4nOy9d5wcd33//3rv7u3u3V6TTjp1W7JsWbYsF1mWK8aywfQSesdAvkAcEgjtFyCAKYEkhEBoSSjBwVRTTcfYyL1Itmw1y5at3u9O18v2z++Pmc/MZ2ZndmdnZ+u9n4/HPe5udnZ2dvazn3l93pWEEGAYhmEYhmGYUL1PgGEYhmEYhmkMWBgyDMMwDMMwAFgYMgzDMAzDMDosDBmGYRiGYRgALAwZhmEYhmEYHRaGDMMw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40MXG17TXuJ6KvQmsvt5OIfgazjuEIPHYQEUJkiOgV0OoX/o6IHoDW9m8awDIAlwA4A1rdQC834E9Ds4p9HMD9RPQogM3Qyp/0QktCeY6+7z0Oz3fjHgB/TUSXQnNZyzqGIQDvEkpNSIXfAPglEf0SmmC5EJp1bhhWYfNcAF8gogeh1QccgFZT72XQEjqcavnZWQxN8HxNT255AloJoEXQPueF+jl8Wj5BCPEEEd0I4L8BPEZEt0HL+O2Ddt3HoSWxlEQI8UNdnL0GwC4i+hU0t/PLoZWf+YkQ4gcOT90OrS7ho0R0O8w6hr0APqyLfTt/BPBFInoBgG0w6xgmAbzdJTFFPddTet3OXwJ4iIjuBLBLP99l0JJT+qCVXgKC+XwYpnWpd1o0//BPK/9ALzNSYp/l+n43l9jvKmg14o5Bqwk3CE10/Qds9Qr1/Z8LTTBOQxN
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_artist = scrobbles.query(f'artist == \"{artist_name}\"')\n",
"# resample by day and mean\n",
"filtered_artist = filtered_artist.resample(\"1W\").count()\n",
"\n",
"filtered_artist[\"energy\"].plot()\n",
"\n",
"plt.title(f\"{artist_name} Scrobbles\")\n",
"plt.grid()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 51,
"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\"?>\r\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n<!-- Created with matplotlib (https://matplotlib.org/) -->\r\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\">\r\n <metadata>\r\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#\">\r\n <cc:Work>\r\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\r\n <dc:date>2021-02-01T20:15:08.316248</dc:date>\r\n <dc:format>image/svg+xml</dc:format>\r\n <dc:creator>\r\n <cc:Agent>\r\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\r\n </cc:Agent>\r\n </dc:creator>\r\n </cc:Work>\r\n </rdf:RDF>\r\n </metadata>\r\n <defs>\r\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\r\n </defs>\r\n <g id=\"figure_1\">\r\n <g id=\"patch_1\">\r\n <path d=\"M 0 288.512187 \r\nL 372.103125 288.512187 \r\nL 372.103125 0 \r\nL 0 0 \r\nz\r\n\" style=\"fill:none;\"/>\r\n </g>\r\n <g id=\"axes_1\">\r\n <g id=\"patch_2\">\r\n <path d=\"M 30.103125 239.758125 \r\nL 364.903125 239.758125 \r\nL 364.903125 22.318125 \r\nL 30.103125 22.318125 \r\nz\r\n\" style=\"fill:#ffffff;\"/>\r\n </g>\r\n <g id=\"matplotlib.axis_1\">\r\n <g id=\"xtick_1\">\r\n <g id=\"line2d_1\">\r\n <path clip-path=\"url(#pf00d7e3f5d)\" d=\"M 39.403125 239.758125 \r\nL 39.403125 22.318125 \r\n\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\r\n </g>\r\n <g id=\"line2d_2\">\r\n <defs>\r\n <path d=\"M 0 0 \r\nL 0 3.5 \r\n\" id=\"mb408a57e7e\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n </defs>\r\n <g>\r\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.403125\" xlink:href=\"#mb408a57e7e\" y=\"239.758125\"/>\r\n </g>\r\n </g>\r\n <g id=\"text_1\">\r\n <!-- Jan -->\r\n <g transform=\"translate(31.695312 254.356562)scale(0.1 -0.1)\">\r\n <defs>\r\n <path d=\"M 9.8125 72.90625 \r\nL 19.671875 72.90625 \r\nL 19.671875 5.078125 \r\nQ 19.671875 -8.109375 14.671875 -14.0625 \r\nQ 9.671875 -20.015625 -1.421875 -20.015625 \r\nL -5.171875 -20.015625 \r\nL -5.171875 -11.71875 \r\nL -2.09375 -11.71875 \r\nQ 4.4375 -11.71875 7.125 -8.046875 \r\nQ 9.8125 -4.390625 9.8125 5.078125 \r\nz\r\n\" id=\"DejaVuSans-74\"/>\r\n <path d=\"M 34.28125 27.484375 \r\nQ 23.390625 27.484375 19.1875 25 \r\nQ 14.984375 22.515625 14.984375 16.5 \r\nQ 14.984375 11.71875 18.140625 8.90625 \r\nQ 21.296875 6.109375 26.703125 6.109375 \r\nQ 34.1875 6.109375 38.703125 11.40625 \r\nQ 43.21875 16.703125 43.21875 25.484375 \r\nL 43.21875 27.484375 \r\nz\r\nM 52.203125 31.203125 \r\nL 52.203125 0 \r\nL 43.21875 0 \r\nL 43.21875 8.296875 \r\nQ 40.140625 3.328125 35.546875 0.953125 \r\nQ 30.953125 -1.421875 24.3125 -1.421875 \r\nQ 15.921875 -1.421875 10.953125 3.296875 \r\nQ 6 8.015625 6 15.921875 \r\nQ 6 25.140625 12.171875 29.828125 \r\nQ 18.359375 34.515625 30.609375 34.515625 \r\nL 43.21875 34.515625 \r\nL 43.21875 35.40625 \r\nQ 43.21875 41.609375 39.140625 45 \r\nQ 35.0625 48.390625 27.6875 48.390625 \r\nQ 23 48.390625 18.546875 47.265625 \r\nQ 14.109375 46.140625 10.015625 43.890625 \r\nL 10.015625 52.203125 \r\nQ 14.9375 54.109375 19.578125 55.046875 \r\nQ 24.21875 56 28.609375 56 \r\nQ 40.484375 56 46.34375 49.84375 \r\nQ 52.203125 43.703125 52.203125 31.203125 \r\nz\r\n\" id=\"DejaVuSans-97\"/>\r\n <path d=\"M 54.890625 33.015625 \r\nL 54.890625 0 \r\nL 45.90625 0 \r\nL 45.90625 32.71875 \r\nQ 45.90625 40.484375 42.875 44.328125 \r\nQ 39.84375 48.1875 33.796875 48.1875 \r\nQ 26.515625 48.1875 22.3125 43.546875 \r\nQ 18.109375 38.921875 18.109375 30.90625 \r\nL 18.109375 0 \r\nL 9.078125 0 \r\nL 9.078125 54.6875 \r\nL 18.109375 54.6875 \r\
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAHmCAYAAADOVtIGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOydZ3hURduA79lN7wkQeu8k9BZ6FRFQQEAQpVhQwO6Lfvr6qth7RewogoAIIkhH6dKlSAk9hJZAIL1ny3w/ZrMJySakkhDmvq69dvecmTlzyp59zlOFlBKNRqPRaDQaTfnFUNYT0Gg0Go1Go9HkjxbYNBqNRqPRaMo5WmDTaDQajUajKedogU2j0Wg0Go2mnKMFNo1Go9FoNJpyjhbYNBqNRqPRaMo5WmDTaDQajUajKedogU2j0Wg0Go2mnKMFNo1Go9FoNJpyjhbYNBqNRqPRaMo5WmDTaDQajUajKedogU1TLhFCzBZCSCFEvUL0CRdChOdYNtE2zsQSnmKJ4Gg/hRD1bMtmF2Kccr2fOXF0rjTFo7SvgaL8JjWlh/4N3XpogU2D7Sac32tiWc/xZkAI0UQI8bEQYp8QIkYIYbK97xJCfCiEaF/WcywthBCVhBAvCyG2CyGu2vY9WgixVQjxXyFE1bKe443G9tvZVNbzKChCiOm2Ofcu67lcD6EYKYRYJoSIEEJk2K63v4UQzwohPMp6jgUl23Ev6Cu8rOesKRucynoCmnLFa3ksP3AjJ1HC/A7sBCJLawNCCAG8YnsZgH3AQiAG8AZaAU8A/xFCPC6lnJmt+4vAu8DF0ppfaSOEGAL8DPgCp1DHPMr2vTPwJvBfIUQjKeWlMptoxae0r/Vyca0K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GqaY555fLZkVJmADNRf+Z5na+XpZRXHfSNz2P5BZSGsZkQok62VRNQ2qmvcl432foVlCkoDeNTUsprrh0p5XqUpupOIYR3QffnOjg6z7EymzaliExBHfs3pAMNs4NjYkYJeDnbFWR/AlACOiht5PXIbFPDto00lLavKkrTlp37ASNKCweAEKI1SuP4m5TylxzzjUPdH91QGuycLJM5tLM3mAXZr1HbeZ5r+3pYSjkvR/s5tvc2mQuKuf+aUkCbRDV2pJSiAM3+lVKmO1jeBXUjHiWEGOVgvQtQRQhRSSon4Xa25Y7++OKFEAdQN4vs5NkH5dtlKcD8M+cKUFcIMd3B+sa29+YoDVBRqYe6qWXnLMr8VBD25SE4bUIJD23J9gdjw9HxtAgh/kYJqW1tc9iMEjJfsJmHV6FMpAeklAU9jsUlXkp5ysHyzD9a/+wLbcLT/6EEszooc3x2auaxnd15TUAI0Q2lgeyC0u655GhSE+VfBxBie1+d13iFIPMa7CWE6OhgfSBKgGiC0kxlJ8/9ccBC1P4tFUIsBv4CtjkSfotIYY7JPJTGL1QI8QvqGtwmpbxSQnMpCLNRZtUJKDN4JhNQ96/52ZZlniPfPO4TVWzvzR2sK8w5Kg1yPgSD0hpD7usJsh44a2VbVpz915QCWmDTFJa80jJUQl1POQWUnGSaQn1t3/OK4HK0nTz7SCnNQoiCah0q2d4dCZbZ8SrAWJdQN6waDua0CeUXlhm9lkuzcB2ud2x8HawrUB8pZYIQIgSlLb2LLI3DVSHEl8CbUsrrzTczYjAvQel6xOWxPNPPz5i5QAjRAPUn6I/ypVmH0kBaUILxBJRfmSMcXrNCiOEoTVoaylx0GhV8YQV6ox4Yso/pZ3svibQWmdfgc9dp5+gaLHBqFCnlbiFED+AllF/VOAAhxHHgNSnlgoKOlQd+tvfrHhMp5ce23+hUlEb+aUAKITYDzznQtOckBmVGdgFqo3zl8qO27T1TUEFKuV0IcQK4SwjhL6WMtT2wBANLc2j6Ms/
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_artist = scrobbles.query(f'artist == \"{artist_name}\"')\n",
"# 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",
"filtered_artist.plot()\n",
"\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": 13,
"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\"?>\r\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n<svg height=\"277.314375pt\" version=\"1.1\" viewBox=\"0 0 455.1625 277.314375\" width=\"455.1625pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n <metadata>\r\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#\">\r\n <cc:Work>\r\n <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\r\n <dc:date>2021-02-01T20:51:08.646361</dc:date>\r\n <dc:format>image/svg+xml</dc:format>\r\n <dc:creator>\r\n <cc:Agent>\r\n <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\r\n </cc:Agent>\r\n </dc:creator>\r\n </cc:Work>\r\n </rdf:RDF>\r\n </metadata>\r\n <defs>\r\n <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\r\n </defs>\r\n <g id=\"figure_1\">\r\n <g id=\"patch_1\">\r\n <path d=\"M 0 277.314375 \r\nL 455.1625 277.314375 \r\nL 455.1625 0 \r\nL 0 0 \r\nz\r\n\" style=\"fill:none;\"/>\r\n </g>\r\n <g id=\"axes_1\">\r\n <g id=\"patch_2\">\r\n <path d=\"M 113.1625 239.758125 \r\nL 447.9625 239.758125 \r\nL 447.9625 22.318125 \r\nL 113.1625 22.318125 \r\nz\r\n\" style=\"fill:#ffffff;\"/>\r\n </g>\r\n <g id=\"patch_3\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 40.188538 \r\nL 432.019643 40.188538 \r\nL 432.019643 32.201761 \r\nL 113.1625 32.201761 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_4\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 50.172009 \r\nL 356.510791 50.172009 \r\nL 356.510791 42.185232 \r\nL 113.1625 42.185232 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_5\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 60.15548 \r\nL 325.206544 60.15548 \r\nL 325.206544 52.168704 \r\nL 113.1625 52.168704 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_6\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 70.138951 \r\nL 315.6168 70.138951 \r\nL 315.6168 62.152175 \r\nL 113.1625 62.152175 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_7\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 80.122423 \r\nL 172.374907 80.122423 \r\nL 172.374907 72.135646 \r\nL 113.1625 72.135646 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_8\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 90.105894 \r\nL 216.436376 90.105894 \r\nL 216.436376 82.119117 \r\nL 113.1625 82.119117 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_9\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 100.089365 \r\nL 244.08599 100.089365 \r\nL 244.08599 92.102588 \r\nL 113.1625 92.102588 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_10\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 110.072836 \r\nL 209.05489 110.072836 \r\nL 209.05489 102.086059 \r\nL 113.1625 102.086059 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_11\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 120.056307 \r\nL 229.118976 120.056307 \r\nL 229.118976 112.06953 \r\nL 113.1625 112.06953 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_12\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 130.039778 \r\nL 195.50744 130.039778 \r\nL 195.50744 122.053001 \r\nL 113.1625 122.053001 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_13\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 140.023249 \r\nL 192.03744 140.023249 \r\nL 192.03744 132.036472 \r\nL 113.1625 132.036472 \r\nz\r\n\" style=\"fill:#1f77b4;\"/>\r\n </g>\r\n <g id=\"patch_14\">\r\n <path clip-path=\"url(#p9754eefc80)\" d=\"M 113.1625 150.00672 \r\nL 221.684683 150.00672 \r\n
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAvYAAAHRCAYAAAABoP0zAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9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ze2vO08vAHLNnRMTtpAuscjv7kQLT4yL/D5/rv8qcd00a4QBS8HBUFB5ujYgJpDQJSA/Ctqa9BZlzBPQy0oX0AaW/b0VvUf2h+rYIUgA4nXQe59wY8U4r2/uEdOes3E69v4P/l99rPX/Rnn8rqrkv5s7tvoj0PWb9ruWfxWGkv1+HFv/9BIiI6RExMdddgPSw53jgyCg86Jr//DNysN3KvhIRU0h/Bxdn9u9cLZuSRuf/HRGXltq5knSHYU3SnZmKi5l9F7fom6T/Hy6Njnuwu5rKHa2/N1srnWuY/fvTozgVx6xnmxzVH6B7A1iFNOpW9jrp344VmT2LySak/8B3l7R7lX0WBpaXtGxLwUH+T/JgSSeQRuz6k1Ir+gE/zdu+GxE3Vdn9nipl9wIzgC8VyjbJ7xuo+nSGX8jva5NuVxeNqVL/1fy+dJVtneFSUkrRg5KuJOWL3xcRr7Wyncp56l3jPC2f3+fKm6dx5+nRqD7rx6uF/iGpFykt5dWo/hD5va04ZrMkLUlKvXo9Sjnc2d35/UtVtlVrbwFSTvBMUvoLABHxrqQbSRdOO5FGh8seKweWbRURTfl43wQelXQ1Kf3qwaieCtOcS0mpIk9JuoL0d/O+SsBbp2Xz+6RqG9v5b0U1c/3ORsTHkt5izt/ZtUh3Nx6MiDdaaPMLpPSx54FfSapWZyrV/w7V4wLSwMpASWfngYlqvpzf766x/W5SUP8l0h1ISL+Lp5AumP9aqLt
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"artists = fmnet.top_artists(period=fmnet.Range.OVERALL, limit=20)\n",
"\n",
"filtered_artists = [scrobbles.query(f'artist == \"{i}\"') for i in artists]\n",
"artists_time = [i[\"duration_ms\"].sum() for i in filtered_artists]\n",
"\n",
"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 Spent Listening to Artists (Since Nov 17)\")\n",
"plt.show()"
]
},
{
"source": [
"# Imports & Setup"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 6,
"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 descriptor_headers, float_headers, days_since\n",
"\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",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"scrobbles = get_query()"
]
},
{
"source": [
"## Write Scrobble Frame"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"scrobbles.to_csv(cache, sep='\\t')"
]
}
]
}