listening-analysis/album.ipynb

357 lines
1.0 MiB
Plaintext
Raw Normal View History

{
"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"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"source": [
"# Album Investigations"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 67,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
2021-02-04 13:34:25 +00:00
"226 scrobbles\n1 days spent listening since Nov. 2017\n0.68 minutes/day\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
" acousticness danceability duration_ms energy instrumentalness \\\n",
2021-02-04 13:34:25 +00:00
"mean 0.148391 0.722531 207801.309735 0.704982 0.000695 \n",
"std 0.157705 0.084484 48556.204645 0.123508 0.001212 \n",
"min 0.002070 0.512000 59118.000000 0.505000 0.000000 \n",
"25% 0.045400 0.646000 156780.000000 0.579000 0.000000 \n",
"50% 0.133000 0.744000 213358.000000 0.697000 0.000000 \n",
"75% 0.155000 0.756000 237297.000000 0.867000 0.000333 \n",
"max 0.600000 0.836000 291808.000000 0.881000 0.002850 \n",
"\n",
2021-02-04 13:34:25 +00:00
" key liveness loudness mode speechiness tempo \\\n",
"mean 6.654867 0.289531 -6.128080 0.818584 0.314686 109.640204 \n",
"std 3.064550 0.224769 2.604052 0.386218 0.152575 25.150042 \n",
"min 1.000000 0.047900 -16.808000 0.000000 0.162000 70.128000 \n",
"25% 7.000000 0.110000 -7.491000 1.000000 0.180000 85.486000 \n",
"50% 7.000000 0.330000 -6.164000 1.000000 0.252000 108.126000 \n",
"75% 9.000000 0.356000 -4.197000 1.000000 0.406000 129.983000 \n",
"max 11.000000 0.959000 -3.626000 1.000000 0.863000 144.056000 \n",
"\n",
" time_signature valence \n",
2021-02-04 13:34:25 +00:00
"mean 3.915929 0.487842 \n",
"std 0.361495 0.159650 \n",
"min 3.000000 0.062200 \n",
"25% 4.000000 0.379000 \n",
"50% 4.000000 0.432000 \n",
"75% 4.000000 0.666000 \n",
"max 5.000000 0.784000 "
],
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.148391</td>\n <td>0.722531</td>\n <td>207801.309735</td>\n <td>0.704982</td>\n <td>0.000695</td>\n <td>6.654867</td>\n <td>0.289531</td>\n <td>-6.128080</td>\n <td>0.818584</td>\n <td>0.314686</td>\n <td>109.640204</td>\n <td>3.915929</td>\n <td>0.487842</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.157705</td>\n <td>0.084484</td>\n <td>48556.204645</td>\n <td>0.123508</td>\n <td>0.001212</td>\n <td>3.064550</td>\n <td>0.224769</td>\n <td>2.604052</td>\n <td>0.386218</td>\n <td>0.152575</td>\n <td>25.150042</td>\n <td>0.361495</td>\n <td>0.159650</td>\n </tr>\n <tr>\n <th>min</th>\n <td>0.002070</td>\n <td>0.512000</td>\n <td>59118.000000</td>\n <td>0.505000</td>\n <td>0.000000</td>\n <td>1.000000</td>\n <td>0.047900</td>\n <td>-16.808000</td>\n <td>0.000000</td>\n <td>0.162000</td>\n <td>70.128000</td>\n <td>3.000000</td>\n <td>0.062200</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>0.045400</td>\n <td>0.646000</td>\n <td>156780.000000</td>\n <td>0.579000</td>\n <td>0.000000</td>\n <td>7.000000</td>\n <td>0.110000</td>\n <td>-7.491000</td>\n <td>1.000000</td>\n <td>0.180000</td>\n <td>85.486000</td>\n <td>4.000000</td>\n <td>0.379000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>0.133000</td>\n <td>0.744000</td>\n <td>213358.000000</td>\n <td>0.697000</td>\n <td>0.000000</td>\n <td>7.000000</td>\n <td>0.330000</td>\n <td>-6.164000</td>\n <td>1.000000</td>\n <td>0.252000</td>\n <td>108.126000</td>\n <td>4.000000</td>\n <td>0.432000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>0.155000</td>\n <td>0.756000</td>\n <td>237297.000000</td>\n <td>0.867000</td>\n <td>0.000333</td>\n <td>9.000000</td>\n <td>0.356000</td>\n <td>-4.197000</td>\n <td>1.000000</td>\n <td>0.406000</td>\n <td>129.983000</td>\n <td>4.000000</td>\n <td>0.666000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>0.600000</td>\n <td>0.836000</td>\n <td>291808.000000</td>\n <td>0.881000</td>\n <td>0.002850</td>\n <td>11.000000</td>\n <td>0.959000</td>\n <td>-3.626000</td>\n <td>1.000000</td>\n <td>0.863000</td>\n <td>144.056000</td>\n <td>5.000000</td>\n <td>0.784000</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
2021-02-04 13:34:25 +00:00
"execution_count": 67
}
],
"source": [
2021-02-04 13:34:25 +00:00
"album_name = \"dicaprio 2\".lower()\n",
"album_frame = scrobbles[scrobbles[\"album\"].str.lower() == album_name]# FILTER SCROBBLES\n",
"album_frame = album_frame.sort_index(ascending=False) # SORT\n",
"# album_frame = album_frame.loc[:, descriptor_headers] # DESCRIPTORS\n",
"\n",
"total_time = album_frame[\"duration_ms\"].sum() / (1000 * 60) # minutes\n",
"total_days = total_time / (60 * 24) # days\n",
"print(f'{album_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",
"album_frame.describe()[1:]"
]
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 68,
"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:17:31.539909</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(#p4ddf303d7e)\" 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=\"m58a5dc3869\" 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=\"#m58a5dc3869\" y=\"239.758125\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_3\">\n <path clip-path=\"url(#p4ddf303d7e)\" d=\"M 42.425 239.758125 \nL 42.425 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=\"42.425\" xlink:href=\"#m58a5dc3869\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(34.717188 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
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAHmCAYAAADZdELPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AACPeklEQVR4nO29d5gb13n9f15ge+N2NpEUi3pvVLdEF7lLluNeZcexbMdxix2XfF0S/xIncUvsuEiucbckW5ItW3KleqEkqlCNYhM7ub1hd7EL4P7+mLmDCxC7izIDDGbO53n2WRIYzMxeAIODt5xXlFIghBBCCCGVJ1LpEyCEEEIIIRYUZoQQQgghPoHCjBBCCCHEJ1CYEUIIIYT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kugdXY8hL7If8E4Pkicpe93QSsMVcvhfUeuHahYxISOCrt18Ef/oT5B1b66/2wUkRxAAdgmYEugvVh+FzW9lchy//LuG8lLHuEXbD8qAZhmXd+Kmu7FbCiMPthCZcnYX1A1tj7vj1r+8/Zt19qH/9R+3H9sExUl+Y4l9uR5XFVwN9xDqxC+n7779gD4FsAlhWwrj9E2strrp8f5rmvFQD+3j6nrQDG7PM6COD3sOwscvptwbKGuANW7dW0/dz8FMCZ+ayFsU07rIjmNvt1MgIrPXtZjm0vtff3OVhdkn+2z3kclng/J8djXH2OYYm562C9nmfs/TwK4CsAzja2u8ze/1P2GsXsNf4aFvCK4w9/gvojShVSm0sICRu2zcFnAWxQSt1e2bMhhJBgwxozQgghhBCfQGFGCCGEEOITKMwIIYQQQnwCa8wIIYQQQnwCI2a
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_album = scrobbles[scrobbles[\"album\"].str.lower() == album_name]\n",
"# resample by day and mean\n",
"filtered_album = filtered_album.resample(\"3W\").count()\n",
"\n",
"filtered_album[\"energy\"].plot()\n",
"\n",
"plt.title(f\"{album_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 album. \"*All Listened Tracks*\" describes the descriptor based on the listening activity for this album. 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 album. If the blue bar is higher than the red, it would indicate that tracks from this album which have a higher value for this are listened to more. "
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 69,
"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:17:32.392896</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(#p963f63a0ba)\" d=\"M 45.321307 239.758125 \nL 61.2209 239.758125 \nL 61.2209 198.451204 \nL 45.321307 198.451204 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 90.748715 239.758125 \nL 106.648308 239.758125 \nL 106.648308 87.456936 \nL 90.748715 87.456936 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 136.176124 239.758125 \nL 152.075717 239.758125 \nL 152.075717 95.781782 \nL 136.176124 95.781782 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 181.603532 239.758125 \nL 197.503125 239.758125 \nL 197.503125 239.705431 \nL 181.603532 239.705431 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 227.03094 239.758125 \nL 242.930533 239.758125 \nL 242.930533 173.181103 \nL 227.03094 173.181103 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 272.458349 239.758125 \nL 288.357942 239.758125 \nL 288.357942 166.216811 \nL 272.458349 166.216811 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 317.885757 239.758125 \nL 333.78535 239.758125 \nL 333.78535 144.500767 \nL 317.885757 144.500767 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 61.2209 239.758125 \nL 77.120493 239.758125 \nL 77.120493 207.491992 \nL 61.2209 207.491992 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 106.648308 239.758125 \nL 122.547901 239.758125 \nL 122.547901 82.65099 \nL 106.648308 82.65099 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 152.075717 239.758125 \nL 167.97531 239.758125 \nL 167.97531 86.466773 \nL 152.075717 86.466773 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_13\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 197.503125 239.758125 \nL 213.402718 239.758125 \nL 213.402718 239.607023 \nL 197.503125 239.607023 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_14\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 242.930533 239.758125 \nL 258.830126 239.758125 \nL 258.830126 176.80251 \nL 242.930533 176.80251 \nz\n\" style=\"fill:#ff0000;\"/>\n </g>\n <g id=\"patch_15\">\n <path clip-path=\"url(#p963f63a0ba)\" d=\"M 288.357942 239.758125 \nL 304.25
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAG5CAYAAAAzjmgkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AABQLElEQVR4nO3deZwUxf3/8ddnuXFZQEEOEUHwQAQPFNSAIqhIOLwweAYwBgw/osTEeICwYIxoDCpEVOKBIoqIBk8uRTwjGA1fRFEEXDGCgnK5uoKw9fujepbZ2ZndmdmrWd7Px2Mes1vd1V1d093zmarqbnPOISIiIiLhlVHZBRARERGR4ilgExEREQk5BWwiIiIiIaeATURERCTkFLCJiIiIhJwCNhEREZGQU8AmIiIiEnIK2ERERERCTgGbiIiISMgpYBMREREJOQVsIiIiIiGngE32KWaWY2Y5MWmDzcyZ2eDKKVXZqCrbIZIKM5sW7PetKrssIuVJAZuIJMXMDjKz35vZ3CDw3WFm35nZQjM7v5TLHhV86TozO6Ksyryvi6rTyGuHmW0ysw/M7EEz621m1Sq7nGGgHzwSduacq+wyiFSYSOuac65VVFp9oBmwwTm3rXJKVnrlvR1mNgG4HvgceB34GjgEOB+oBdzlnLs2jeUasDZYlgF/d879qazKvS8zs8gJflzwXg1oALQHfgHUBP4DXOqcW1XhBSwDZtYMqA+scc79XIrlDAYeAY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8D7KzCLdPJFun9tSWM4L+AH5/c3s4tiJZtYi6t+c4L17zDyHAreXsJ7LzSx23Es2vgvmyTS6GWPNwXfbXWxmJ8VMG4lvMXrFOVfi+LXgIoGpwHD8+KP+QatKOiIXFAx3zl0
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_album = scrobbles[scrobbles[\"album\"].str.lower() == album_name]\n",
"filtered_album_no_dup = filtered_album.drop_duplicates(['uri'])\n",
"\n",
"filtered_album_no_dup = filtered_album_no_dup.loc[:, float_headers].mean()\n",
"filtered_album_dup = filtered_album.loc[:, float_headers].mean()\n",
"\n",
"x = np.arange(len(float_headers))\n",
"width = 0.35\n",
"plt.bar(x - width/2, filtered_album_no_dup, width, label='All Listened Tracks')\n",
"plt.bar(x + width/2, filtered_album_dup, width, label='Distinct Tracks', color=(1, 0, 0))\n",
"\n",
"plt.title(f\"{album_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": 70,
"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:17:33.466683</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(#pf212fda5a1)\" d=\"M 56.887125 239.758125 \nL 56.887125 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=\"md97b15677e\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"56.887125\" xlink:href=\"#md97b15677e\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(49.179312 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": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAHmCAYAAADOVtIGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOzdd3iUxdrA4d9sTe8koUPovQiISFX02I4gimAvx4K9c/TY9bMeu2I5NuwNu1iRpiIiJZSEDgFCSCC97mbLfH+8m5DNvptsepv7unJtMm+bLdl9dsozQkqJoiiKoiiK0noZWroCiqIoiqIoSs1UwKYoiqIoitLKqYBNURRFURSllVMBm6IoiqIoSiunAjZFURRFUZRWTgVsiqIoiqIorZwK2BRFURRFUVo5FbApiqIoiqK0cipgUxRFURRFaeVUwKYoiqIoitLKqYBNURRFURSllVMBm9JshBBpQoi0amWXCiGkEOLSlqlV42gv96MmQohenvu4sKXr0p4IIRZ6HtdeTXR+n/87pWWo/yGlIVTApihtgBCiqxDiBiHED54PYLsQIkcI8YsQYlYDzjtQCPGiEGKLEKJACFEuhMgQQiwWQvxLCGFtzPvR2gkhpno+UB9o6boESgixXAghW7oegRBChAghbhFCrBRCZHteb4eEEN8KIWYLIURL1zFQFY97HX4WtnSdlbbN1NIVUDq8L4HVwKGWrkgDNfX9uAH4N7AXWAZkAj2BWcB0IcSzUspb63JCIcR9wP1oX9z+BN4BioEEYCrwBnANMKZx7oLix13A48DBJjr/iU103joRQgwBvgV6A/uAz4EcoAdwOnAG8IsQ4lwpZX5L1bMOFgLLq5XNBEYAXwPJ1bYloz3Hg4CCpqyY0j6pgE1pUVLKAtrBm1cz3I81wFQp5YqqhUKIQWiB4i1CiA+klOsCOZkQ4j/Ag8ABYLaU8i+dfc4AbmtwzZUaSSkP0YRfWKSUu5vq3IESQiQCvwCdgceA+6SUzirbY4APgX8AnwohTpFSuluksgGSUi6sXubp1h4BfKW33WNb09V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FpDvAghjkd7fo5D69azVNulK773P01Kqdvd7AlUL0Br7RqB1qJgrLJL9W738WiBh17Xa8CEECGe62UDN/vJQGHH+8Ozgt/748cHaM9vqhDiY7TX6h9Sv5u+Tjz/L0OBLJ0vLF6klIVCiG/RvkQlCyE+R3u9/SWlLG1oXergHbSuwblo3cEIIRLQgvMNUspNVfateA2O8JOepb/ndhBaC1VVdfn/bgprdcoyPLd6E4oqgrtuVcoacv+VVkwFbEpjivTc+ozN8QQogbYMRHlua01zIIQwowVE49DG2HyC1nVQ0TJxP1rXgR5/Y4gyPbeRNWwLRMXx/mYAVpRH1eGcAAghnkQbg7cSOF2vxakGh9DerP0FsrXJ91PupFpuRyHEWWgtaTa0WYK70bp33Gjdj1PQf35qepyfAW5Gux8/ob1OKlq7LkUbz1VVFJCn0yJWV9FoXwQ6ob2u6qIurxuklM94/l+uRRsTejMghRArgDuklHof7IGK8twGmkZkDloX/vkcHSdnE0IsQms19DsWz6PivncP4FoV+5SjtVZWeBetBfMSPAEbWtBuwrt1DTwtc8CVtVwrrIa6thS9mebOALaZq5Q15P4rrZgK2JTGVPGGkoA2XqiSEMIExBFYN1y+5zaQgGIGWrC2UEp5WdUNQojO1PzBmuCnPNFz6/MG6afr1Z+K4xP9bO9cbb+ACCGeRfsAX4Y2M66uLR2/Ayeg5ed6s47H1tXDaB++Y6p32QohXkML2PToPs5CiHi0AGYLMEFKWVRt+3k6h+UDsUKI4AYGbRXP0wYp5ega9/RVl9eNdoCU7wLvCiGi0MaHngVcDvw
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"filtered_album = scrobbles[scrobbles[\"album\"].str.lower() == album_name]\n",
"# select only descriptor float columns\n",
"filtered_album = filtered_album.loc[:, float_headers]\n",
"# resample by day and mean\n",
"filtered_album = filtered_album.resample(\"1M\").mean()\n",
"\n",
"# filtered_album[\"energy\"].plot()\n",
2021-02-04 13:34:25 +00:00
"filtered_album.plot(lw=3)\n",
"\n",
"plt.title(f\"{album_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": [
"# Album Listening Time"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"limit = 50\n",
"albums = fmnet.top_albums(period=fmnet.Range.OVERALL, limit=limit)\n",
"\n",
"filtered_albums = [scrobbles[scrobbles[\"album\"] == i.name] for i in albums]\n",
"\n",
"### STATS ###\n",
"# total time listening to artists \n",
"albums_time = [i[\"duration_ms\"].sum() for i in filtered_albums]\n",
"# total number of tracks\n",
"albums_track_count = np.array([i.drop_duplicates([\"uri\"]).count()[0] for i in filtered_albums])\n",
"# average length of artist's tracks (ms)\n",
"albums_average_track_length = np.array([i.drop_duplicates([\"uri\"])[\"duration_ms\"].mean() for i in filtered_albums])\n",
"\n",
"fig_size = (7,(5/20)*limit)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 840x1500 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=\"739.374375pt\" version=\"1.1\" viewBox=\"0 0 713.873438 739.374375\" width=\"713.873438pt\" 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-03T16:04:39.973563</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 739.374375 \nL 713.873437 739.374375 \nL 713.873437 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 316.073438 701.818125 \nL 706.673437 701.818125 \nL 706.673437 22.318125 \nL 316.073438 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 63.127818 \nL 661.110179 63.127818 \nL 661.110179 53.204489 \nL 316.073438 53.204489 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 75.53198 \nL 674.972212 75.53198 \nL 674.972212 65.608651 \nL 316.073438 65.608651 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 87.936143 \nL 417.736348 87.936143 \nL 417.736348 78.012813 \nL 316.073438 78.012813 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 100.340305 \nL 543.972721 100.340305 \nL 543.972721 90.416975 \nL 316.073438 90.416975 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 112.744467 \nL 688.073437 112.744467 \nL 688.073437 102.821137 \nL 316.073438 102.821137 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 125.148629 \nL 535.636957 125.148629 \nL 535.636957 115.225299 \nL 316.073438 115.225299 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 137.552791 \nL 514.302717 137.552791 \nL 514.302717 127.629461 \nL 316.073438 127.629461 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 149.956953 \nL 482.399405 149.956953 \nL 482.399405 140.033623 \nL 316.073438 140.033623 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 162.361115 \nL 418.442556 162.361115 \nL 418.442556 152.437785 \nL 316.073438 152.437785 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 174.765277 \nL 585.664782 174.765277 \nL 585.664782 164.841948 \nL 316.073438 164.841948 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_13\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 187.169439 \nL 519.28481 187.169439 \nL 519.28481 177.24611 \nL 316.073438 177.24611 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_14\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 199.573601 \nL 473.64534 199.573601 \nL 473.64534 189.650272 \nL 316.073438 189.650272 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_15\">\n <path clip-path=\"url(#pad548ca16a)\" d=\"M 316.073438 2
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKQAAATTCAYAAABLBO+pAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG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Z5KObNGmcV6eajG/MX2+2vThwNpkltSeZVojY+qkrna0uyQtRw4HfZwcctiROcv7VFmIZu8nHrJnZmZmZjbwXgJeiAh18nqkPzoTEf+OiK+TGTcrk8OlPkQWIl+rw4UnawTjDulkn4b2oKuNbZzfyTYWb7LMh+orkzQLXchaKcMr32RyQKfd5d6JiLPJQA3Aml1Zvk0vlvdF22jbOCbzdnIcm2WVdaoMh/wVMDuZKdVRHxZpMf/DtXYN55NDAreUNLOkhYH1gDsj4s7u9Leb2ilm3tC4Xib0YX/MpnkOSJmZmZmZDbwbgflLlsU0IyLeiIgbImJfJte52rjSpHHjPTNTu5ms77NqH3bxPjLw8uXytL123FbeV28ybxWa70tH7gI+LGlQF5cDeLm8Nx1r2EM3lvf1utC2L8/VKcDt5FMov1CfGREvAw8Ci0paqsnyjcDlbdWJpZ7W2eSTB9cia5LNQv9mR81BZhK+QxbS78yy5f2OvuqT2fTAASkzMzMzs4HXyJQ5TtJH6jMlfUDSl+vT+4KklSTN2WRWI6Potcq0xvDBqYozl0LUpwFfkLRPrYh7Y1tLSFq8Pr1dpT7Q4WT2zGHN+i3pw5I+VZk0vLz/n6QPVtrNAfyuG90YRd5Xfak+Q9J3Ja1diq/X5y0C/Kh8vLYb2+3M38ihfPvU9r+x/Y9WPh5B1jA7RNLSTdrOVoZxdlupkbUbGXxrdZxPKPP/WL1eJC0I7FNpUze8vG9dXm+T115/2ZzMJry0k2LmDY3v8si+65LZtM81pMzMzMzMBlhEXCXpl+S
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"plt.figure(figsize=fig_size)\n",
"plt.barh(np.arange(len(albums))[::-1], np.array(albums_time) / (1000 * 60 * 60) )\n",
"plt.yticks(np.arange(len(albums))[::-1], labels=[f'{i.name}, {i.artist[\"name\"]}' for i in albums])\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": 27,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 840x1500 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=\"739.374375pt\" version=\"1.1\" viewBox=\"0 0 713.873438 739.374375\" width=\"713.873438pt\" 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-03T16:04:43.406301</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 739.374375 \nL 713.873437 739.374375 \nL 713.873437 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 316.073438 701.818125 \nL 706.673437 701.818125 \nL 706.673437 22.318125 \nL 316.073438 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 63.127818 \nL 519.347236 63.127818 \nL 519.347236 53.204489 \nL 316.073438 53.204489 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 75.53198 \nL 481.057761 75.53198 \nL 481.057761 65.608651 \nL 316.073438 65.608651 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 87.936143 \nL 400.032427 87.936143 \nL 400.032427 78.012813 \nL 316.073438 78.012813 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 100.340305 \nL 407.900464 100.340305 \nL 407.900464 90.416975 \nL 316.073438 90.416975 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 112.744467 \nL 457.843478 112.744467 \nL 457.843478 102.821137 \nL 316.073438 102.821137 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 125.148629 \nL 447.688602 125.148629 \nL 447.688602 115.225299 \nL 316.073438 115.225299 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 137.552791 \nL 450.790612 137.552791 \nL 450.790612 127.629461 \nL 316.073438 127.629461 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 149.956953 \nL 440.445201 149.956953 \nL 440.445201 140.033623 \nL 316.073438 140.033623 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 162.361115 \nL 411.561075 162.361115 \nL 411.561075 152.437785 \nL 316.073438 152.437785 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 174.765277 \nL 471.005127 174.765277 \nL 471.005127 164.841948 \nL 316.073438 164.841948 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_13\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 187.169439 \nL 478.832617 187.169439 \nL 478.832617 177.24611 \nL 316.073438 177.24611 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_14\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.073438 199.573601 \nL 451.959295 199.573601 \nL 451.959295 189.650272 \nL 316.073438 189.650272 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_15\">\n <path clip-path=\"url(#pfaf981f1b0)\" d=\"M 316.0734
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKQAAATTCAYAAABLBO+pAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOzdd9xk4/nH8c9XJ6wuhMRqkbBKqkS0FSUkSoIQLURCSCRKQvglWgSpBBHd6iXKatHtsghCEFYvq68lyiqrX78/rnvs2bMzzzNPX+v7fr3mNc+cuc997nPmzHCuve7rKCIwMzMzMzMzMzPrL9MM9ADMzMzMzMzMzOyjxQEpMzMzMzMzMzPrVw5ImZmZmZmZmZlZv3JAyszMzMzMzMzM+pUDUmZmZmZmZmZm1q8ckDIzMzMzMzMzs37lgJSZmZmZmZmZmfUrB6TMzMzMzMzMzKxfOSBlZmZmZmZmZmb9ygEpMzMzMzMzMzPrVw5ImZmZmZmZmZlZv3JAyszMzMzMeoWkMZLG1JZtIykkbTMwo5pUszF20j4kjawt268sX613R9d/JA0r+zB4oMfSrintXDKznnFAyszM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4zKZmDkiZmZmZmfWdw4GdgMHN3oyIPSXdAfwU2JosrvwIWb/pzxHxdj+Ns9nYLpe0XhnLpuR0qluBocCi9CwgdRQZHFqBDHBNBzxVlv+5GnyIiHckbQhsCWwDfIsMDjxPBgp+Q97hrurnwIPAT8ji4v8DLgD2Bu7qwbg7chDwbTJotwYZhHmiLD8sIl6q7NMVknYHfkRmEc1ABl+OLO8/JekLZFBtI2ALchrbWDLwdgRwdx/tR5d
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"plt.figure(figsize=fig_size)\n",
"plt.barh(np.arange(len(albums))[::-1], np.array(albums_time) / (albums_track_count * albums_average_track_length) )\n",
"plt.yticks(np.arange(len(albums))[::-1], labels=[f'{i.name}, {i.artist[\"name\"]}' for i in albums])\n",
"plt.xlabel(\"Average plays per song\")\n",
"plt.grid(axis=\"x\")\n",
"plt.title(\"Normalised listening time\")\n",
"plt.show()"
]
},
{
"source": [
"# Imports & Setup"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 2,
"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",
"\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,
"metadata": {},
"outputs": [],
"source": [
"scrobbles = get_query(cache=cache)"
]
},
{
"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')"
]
}
]
}