listening-analysis/artist.ipynb

316 lines
611 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",
"execution_count": 3,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"1,706 scrobbles\n4 days spent listening since Nov. 2017\n4.62 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",
"mean 0.218702 0.574796 202421.407595 0.678473 0.053497 \n",
"std 0.215092 0.162472 59794.180372 0.141701 0.186326 \n",
2021-02-01 21:43:27 +00:00
"min 0.000843 0.256000 48507.000000 0.176000 0.000000 \n",
"25% 0.049700 0.451000 154573.000000 0.584000 0.000000 \n",
"50% 0.161000 0.543000 199053.000000 0.668000 0.000004 \n",
"75% 0.274000 0.657000 226520.000000 0.805000 0.000648 \n",
2021-02-01 21:43:27 +00:00
"max 0.946000 0.948000 513707.000000 0.946000 0.901000 \n",
"\n",
" key liveness loudness mode speechiness tempo \\\n",
"mean 5.482911 0.305708 -8.005934 0.695570 0.289666 110.452840 \n",
"std 3.492010 0.180859 2.022733 0.460311 0.132537 32.528693 \n",
2021-02-01 21:43:27 +00:00
"min 0.000000 0.052900 -16.918000 0.000000 0.029600 56.046000 \n",
"25% 1.000000 0.139000 -9.134000 0.000000 0.203000 87.786000 \n",
"50% 6.000000 0.303000 -8.320000 1.000000 0.299000 91.973000 \n",
"75% 8.000000 0.399000 -6.442000 1.000000 0.380000 130.990000 \n",
2021-02-01 21:43:27 +00:00
"max 11.000000 0.796000 -2.002000 1.000000 0.749000 188.050000 \n",
"\n",
" time_signature valence \n",
"mean 3.996203 0.511429 \n",
"std 0.177908 0.198530 \n",
2021-02-01 21:43:27 +00:00
"min 3.000000 0.038300 \n",
"25% 4.000000 0.373000 \n",
"50% 4.000000 0.516000 \n",
"75% 4.000000 0.638000 \n",
2021-02-01 21:43:27 +00:00
"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.218702</td>\n <td>0.574796</td>\n <td>202421.407595</td>\n <td>0.678473</td>\n <td>0.053497</td>\n <td>5.482911</td>\n <td>0.305708</td>\n <td>-8.005934</td>\n <td>0.695570</td>\n <td>0.289666</td>\n <td>110.452840</td>\n <td>3.996203</td>\n <td>0.511429</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.215092</td>\n <td>0.162472</td>\n <td>59794.180372</td>\n <td>0.141701</td>\n <td>0.186326</td>\n <td>3.492010</td>\n <td>0.180859</td>\n <td>2.022733</td>\n <td>0.460311</td>\n <td>0.132537</td>\n <td>32.528693</td>\n <td>0.177908</td>\n <td>0.198530</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.451000</td>\n <td>154573.000000</td>\n <td>0.584000</td>\n <td>0.000000</td>\n <td>1.000000</td>\n <td>0.139000</td>\n <td>-9.134000</td>\n <td>0.000000</td>\n <td>0.203000</td>\n <td>87.786000</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.543000</td>\n <td>199053.000000</td>\n <td>0.668000</td>\n <td>0.000004</td>\n <td>6.000000</td>\n <td>0.303000</td>\n <td>-8.320000</td>\n <td>1.000000</td>\n <td>0.299000</td>\n <td>91.973000</td>\n <td>4.000000</td>\n <td>0.516000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>0.274000</td>\n <td>0.657000</td>\n <td>226520.000000</td>\n <td>0.805000</td>\n <td>0.000648</td>\n <td>8.000000</td>\n <td>0.399000</td>\n <td>-6.442000</td>\n <td>1.000000</td>\n <td>0.380000</td>\n <td>130.990000</td>\n <td>4.000000</td>\n <td>0.638000</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>"
2021-02-01 21:43:27 +00:00
},
"metadata": {},
"execution_count": 3
2021-02-01 21:43:27 +00:00
}
],
"source": [
"artist_name = \"Freddie Gibbs\".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",
"execution_count": 11,
2021-02-01 21:43:27 +00:00
"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 388.0125 288.512187\" width=\"388.0125pt\" 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:43:23.090337</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 388.0125 288.512187 \nL 388.0125 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 239.758125 \nL 368.0875 239.758125 \nL 368.0875 22.318125 \nL 33.2875 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(#pd55986cdaf)\" d=\"M 33.2875 239.758125 \nL 33.2875 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=\"m873f63180d\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"33.2875\" xlink:href=\"#m873f63180d\" y=\"239.758125\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_3\">\n <path clip-path=\"url(#pd55986cdaf)\" d=\"M 41.6575 239.758125 \nL 41.6575 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.6575\" xlink:href=\"#m873f63180d\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(33.949688 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
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoYAAAHmCAYAAADulk++AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAChbUlEQVR4nO2dd5hb5Zm370ej6cXj3js2xZhiwKYHp/dsQsKG9Pal994hm7Ypu0lIlvQECGkQCKQSAjG9TGxjY4xt3Md9PB5P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IyNuBfwK3iYi3juFzsEp5vDDmNfaJyKexsk+fEJHfY7nrXoAVU/YkcFaKQ34dlhXm5yLyQeBxLJfnPPsYZ2IlqcRLtPGOabeIfBH4GrDZM6bnYV3MN6cxJodtWJ+ht47hUuCvwK/ibP8kVgLIBhG5m0gdw1asMilOhnc98JCI7MJKANqPlX39PKwEiD8ZY7alML6PANeKyBPAeqzvdRJWYshFWGL03d5sXqzs3PuAr4nIlfbfglXn8vlY82LfeC9sjOm359mtwP0iciuW6/o8+zhHsdzZ8XgY2BQzb87G+iy+GWf7I0At8JSI/AlrLr8ay119vTHmgfHGi3WTswz4L+CNdlLVMawOQ6djxR5ejVW3MFffj6JUPvmqg6MPfegj+sH4dQzvG2f/lVi12/ZjFbruwrIc/Rh4dpztz8MSgX324x4scXEtMXUMPftcjeUqHMYSJTdjXWjHjJ0ENQPtdc1YfX03YBXsHsK6QP8VeCfQmMbn9kYs12LsmJ4CulMZE5H6fbXAV+y
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()"
]
},
{
"cell_type": "code",
"execution_count": 5,
2021-02-01 21:43:27 +00:00
"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-03T15:42:50.287346</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(#p1700eb839b)\" d=\"M 39.403125 239.758125 \nL 39.403125 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=\"ma3c4d3aa9b\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.403125\" xlink:href=\"#ma3c4d3aa9b\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(31.695312 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": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAHmCAYAAADOVtIGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOydd3hUxdeA39lNryRA6L1DCB0iSC8KgiBFsCBYUEQUey/ws7dPULCLWFBRROmIICiI9BIIvQQCoSSB9E2yZb4/ZncTQno2hTDv8+TZm1tmzt29e/fcU4WUEo1Go9FoNBpNxcVQ3gJoNBqNRqPRaPJHK2wajUaj0Wg0FRytsGk0Go1Go9FUcLTCptFoNBqNRlPB0QqbRqPRaDQaTQVHK2wajUaj0Wg0FRytsGk0Go1Go9FUcLTCptFoNBqNRlPB0QqbRqPRaDQaTQVHK2wajUaj0Wg0FRytsGk0Go1Go9FUcLTCprkCIcQjQoj9QgiTEEIKIR4tBxmm2+fuU4Rj1gshZI51fezjTHexiMUmL5lyk78QY0khxHpXyldaFOcz1RRMaV4DFfH7cy2jv0PXNlph01yGEGIcMAtIB2YCM4DN5SmTpmIihDAIIUYLIX4VQkQLIdKFEKlCiANCiM+FED3KW8ayRggxz/6D2rC8ZSkMQoiGdnnnlbcshUEI0VwIMUcIcVAIkWK/3g4JIT4WQrQob/kKS7b3vSh/fcpbbk354lbeAmgqHEMdr1LKmHKVxDVsBVoBceUtSDYqokxFQghRE1gI9ACSgT+BY4AAmgG3AZOEEA9LKWeXm6DXBq2AtFIau8Jcq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j2gJOevKWW0S1RTVPJ
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",
"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": 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+r7Xn1a3bM7VX4o3zgbOirf+5rq67uqzvLidSvgAsi4s3SufklHSDpfknv5z+qR0v6j6SLJO3cnKi7hqStCv9+rq1Rp3c+/8Dsjq8WSRtKOk3SHZJG5fjeaqV+P7X9vx9TS5f9DRgDnNmlN2M2h/hMswMwM7MOO6lK2eFAT+AcYHzp3JPAa8AjwP+6MK5muYG5995mp+OBhYA/FAslzQ/cCu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y0u5mkgTXO/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": "iVBORw0KGgoAAAANSUhEUgAAA1wAAAOACAYAAAAuGXKQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AADs4UlEQVR4nOzdebxVVf3/8ddbc0oEZy0rUTTH1PpZZE5oOWU5pDY4YqWmWTmlWQ5kfh3SUstIc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kiN5m09G4HYAKzKutBWmq4IfAT4NuS7iMVOFiRtLdrU1JS+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",
"execution_count": 1,
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",
"execution_count": 2,
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
]
}
]
}