listening-analysis/playlist.ipynb

427 lines
552 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": [
"# Playlists\n",
2021-02-01 21:43:27 +00:00
"\n",
"Below are investigations into listening from a playlist context. The start includes data for individual playlists before comparing a group of playlists.\n",
"\n",
"## Individual Playlist Investigations\n",
"\n",
"Below prepares a frame for processing and gives some high-level stats."
2021-02-01 21:43:27 +00:00
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 4,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"10,999 scrobbles\n28 days spent listening since Nov. 2017\n35.41 minutes/day\n"
2021-02-01 21:43:27 +00:00
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
" duration_ms mode loudness key tempo \\\n",
"mean 223128.125193 0.631694 -6.733293 5.352487 118.354445 \n",
"std 63610.972469 0.482367 2.482966 3.733147 31.002195 \n",
2021-02-01 21:43:27 +00:00
"min 60867.000000 0.000000 -17.819000 0.000000 61.113000 \n",
"25% 182741.000000 0.000000 -8.320000 1.000000 91.923000 \n",
"50% 211200.000000 1.000000 -6.518000 6.000000 116.696000 \n",
"75% 258827.000000 1.000000 -5.062000 8.000000 140.032000 \n",
2021-02-01 21:43:27 +00:00
"max 774920.000000 1.000000 -0.140000 11.000000 207.982000 \n",
"\n",
" time_signature acousticness danceability energy instrumentalness \\\n",
"mean 4.007455 0.179857 0.66556 0.709464 0.008645 \n",
"std 0.255755 0.186482 0.15002 0.145923 0.056757 \n",
"min 1.000000 0.000017 0.26100 0.252000 0.000000 \n",
"25% 4.000000 0.035000 0.55200 0.598000 0.000000 \n",
"50% 4.000000 0.120000 0.67400 0.720000 0.000000 \n",
"75% 4.000000 0.254000 0.77500 0.821000 0.000051 \n",
"max 5.000000 0.864000 0.97500 0.993000 0.847000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" liveness speechiness valence \n",
"mean 0.244309 0.274996 0.480991 \n",
"std 0.172633 0.129368 0.223523 \n",
2021-02-01 21:43:27 +00:00
"min 0.033300 0.032300 0.027200 \n",
"25% 0.113000 0.181000 0.314000 \n",
"50% 0.181000 0.282000 0.483000 \n",
"75% 0.333000 0.361000 0.642000 \n",
2021-02-01 21:43:27 +00:00
"max 0.979000 0.827000 0.962000 "
],
"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>duration_ms</th>\n <th>mode</th>\n <th>loudness</th>\n <th>key</th>\n <th>tempo</th>\n <th>time_signature</th>\n <th>acousticness</th>\n <th>danceability</th>\n <th>energy</th>\n <th>instrumentalness</th>\n <th>liveness</th>\n <th>speechiness</th>\n <th>valence</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>mean</th>\n <td>223128.125193</td>\n <td>0.631694</td>\n <td>-6.733293</td>\n <td>5.352487</td>\n <td>118.354445</td>\n <td>4.007455</td>\n <td>0.179857</td>\n <td>0.66556</td>\n <td>0.709464</td>\n <td>0.008645</td>\n <td>0.244309</td>\n <td>0.274996</td>\n <td>0.480991</td>\n </tr>\n <tr>\n <th>std</th>\n <td>63610.972469</td>\n <td>0.482367</td>\n <td>2.482966</td>\n <td>3.733147</td>\n <td>31.002195</td>\n <td>0.255755</td>\n <td>0.186482</td>\n <td>0.15002</td>\n <td>0.145923</td>\n <td>0.056757</td>\n <td>0.172633</td>\n <td>0.129368</td>\n <td>0.223523</td>\n </tr>\n <tr>\n <th>min</th>\n <td>60867.000000</td>\n <td>0.000000</td>\n <td>-17.819000</td>\n <td>0.000000</td>\n <td>61.113000</td>\n <td>1.000000</td>\n <td>0.000017</td>\n <td>0.26100</td>\n <td>0.252000</td>\n <td>0.000000</td>\n <td>0.033300</td>\n <td>0.032300</td>\n <td>0.027200</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>182741.000000</td>\n <td>0.000000</td>\n <td>-8.320000</td>\n <td>1.000000</td>\n <td>91.923000</td>\n <td>4.000000</td>\n <td>0.035000</td>\n <td>0.55200</td>\n <td>0.598000</td>\n <td>0.000000</td>\n <td>0.113000</td>\n <td>0.181000</td>\n <td>0.314000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>211200.000000</td>\n <td>1.000000</td>\n <td>-6.518000</td>\n <td>6.000000</td>\n <td>116.696000</td>\n <td>4.000000</td>\n <td>0.120000</td>\n <td>0.67400</td>\n <td>0.720000</td>\n <td>0.000000</td>\n <td>0.181000</td>\n <td>0.282000</td>\n <td>0.483000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>258827.000000</td>\n <td>1.000000</td>\n <td>-5.062000</td>\n <td>8.000000</td>\n <td>140.032000</td>\n <td>4.000000</td>\n <td>0.254000</td>\n <td>0.77500</td>\n <td>0.821000</td>\n <td>0.000051</td>\n <td>0.333000</td>\n <td>0.361000</td>\n <td>0.642000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>774920.000000</td>\n <td>1.000000</td>\n <td>-0.140000</td>\n <td>11.000000</td>\n <td>207.982000</td>\n <td>5.000000</td>\n <td>0.864000</td>\n <td>0.97500</td>\n <td>0.993000</td>\n <td>0.847000</td>\n <td>0.979000</td>\n <td>0.827000</td>\n <td>0.962000</td>\n </tr>\n </tbody>\n</table>\n</div>"
2021-02-01 21:43:27 +00:00
},
"metadata": {},
2021-02-04 13:34:25 +00:00
"execution_count": 4
2021-02-01 21:43:27 +00:00
}
],
"source": [
"playlist_name = \"ALL RAP\"\n",
"playlist = get_playlist(playlist_name, spotnet)\n",
"playlist_frame = pd.merge(track_frame(playlist.tracks), scrobbles, on=['track', 'artist']) # FILTER SCROBBLES\n",
"playlist_frame = playlist_frame.sort_index(ascending=False) # SORT\n",
"playlist_frame = playlist_frame.loc[:, spotify_descriptor_headers] # DESCRIPTORS\n",
"\n",
"total_time = playlist_frame[\"duration_ms\"].sum() / (1000 * 60) # minutes\n",
"total_days = total_time / (60 * 24) # days\n",
"print(f'{playlist_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",
"playlist_frame.describe()[1:]"
]
},
{
"source": [
"## Listnening Frequency Over Time"
2021-02-01 21:43:27 +00:00
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 5,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x480 with 1 Axes>",
2021-02-04 13:34:25 +00:00
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"288.512187pt\" version=\"1.1\" viewBox=\"0 0 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-04T10:18:55.470010</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(#p4988a98a52)\" 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=\"m7ccc53875f\" 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=\"#m7ccc53875f\" y=\"239.758125\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_3\">\n <path clip-path=\"url(#p4988a98a52)\" d=\"M 51.549318 239.758125 \nL 51.549318 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=\"51.549318\" xlink:href=\"#m7ccc53875f\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(43.841506 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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t94TOJ8+48xi/i5wuzHmpzhTXZqBi4HVOD0DF2StvdcY8wmc3oePuVXVYzjf54U4xRr/GOeup3GCq8eMMf+DMw7wlThLz5+z1t4V5z53AW8xxlwJ/No99rdxgs+3WWuHFzjXGWPMy4GfAz8xxtyLk8Eed7/ny3F+Xsvd27YD3zfGPICzd/MUTtuim9zz/YfY5xCRHCp0vxx96EMfmX/gtBKxwLuSOPYX7rEvc/9+M5H+dYk+fugee0MSx+5O4hzuIE4fw5hjHnSPeYn7eVcSj/ta99hbA7fF7WOY4s+3Bmf/5udw2tR04/T1G8JZuv8boDPBfS/AqaI+idOOphu4E3hrzHEL9ocEXoMTBI7g9Al8HCfQr41z7BH3owVnnN9JYAon+HoXYGKOX+uew1dxCoFuxelbOI4TID4vznN4187Ncb7WBfw9ThA9DowCB3EC5dfj9mrEWQb/uPscZ9xzPIFTzf2CQv/f0oc+yu3DWLtQw38RERERKQfaYygiIiIigAJDEREREXEpMBQRERERQIGhiIiIiLgUGIqIiIgIoMBQRERERFwKDEVEREQEKOHJJ+7oquuB4zhNZUVERESKVTXOdKA7rbVDhTqJkg0McYLCWwt9EiIiIiIpuAn4n0I9eSkHhscBvvWtb3HxxRfn9YlHR0fZuXMnV1xxBY2NjXl9bpFM6fqVxUrXrixmjz76KK997WvBjV8KpZQDw2mA9evXc8EFF+T1iYeHhzlz5gzbtm2jubk5r88tkildv7JY6dqVxWx0dNT7Y0G3v6n4REREREQABYYiIiIi4lJgKCIiIiKAAkMRERE
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"# filter playlists by join with playlist track/artist names\n",
"filtered_playlist = pd.merge(track_frame(playlist.tracks), scrobbles.reset_index(), on=['track', 'artist'])\n",
"# to time series, select only descriptor float columns\n",
"filtered_playlist = filtered_playlist.set_index('time').loc[:, [\"energy\"]]\n",
"# resample by day and mean\n",
"filtered_playlist = filtered_playlist.resample(\"3W\").count()\n",
"\n",
"filtered_playlist[\"energy\"].plot()\n",
"\n",
"plt.title(f\"{playlist_name} Scrobbles\")\n",
"plt.grid()\n",
"plt.show()"
]
},
{
"source": [
"## Listening Characteristics Over Time"
2021-02-01 21:43:27 +00:00
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 6,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x480 with 1 Axes>",
2021-02-04 13:34:25 +00:00
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"288.512187pt\" version=\"1.1\" viewBox=\"0 0 382.811258 288.512187\" width=\"382.811258pt\" 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:18:56.669412</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 382.811258 288.512187 \nL 382.811258 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(#p8086419130)\" d=\"M 30.103125 239.758125 \nL 30.103125 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=\"m83c8ed3406\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#m83c8ed3406\" y=\"239.758125\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_3\">\n <path clip-path=\"url(#p8086419130)\" d=\"M 48.254932 239.758125 \nL 48.254932 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=\"48.254932\" xlink:href=\"#m83c8ed3406\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- Jan -->\n <g transform=\"translate(40.54712 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
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAn0AAAHmCAYAAAAGOjjQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOydd3gUxd/AP3PJpXeSUBJI6EgHkSIgHUHARlEQFBELirwoKHawYW/YwILwEwQRbIgoooD0Ir3XEEIS0nu73O37x1xCcreXXEIglPk8zz3Jzc7Mzt7t7X73W4WmaSgUCoVCoVAorm4M1b0AhUKhUCgUCsXFRwl9CoVCoVAoFNcASuhTKBQKhUKhuAZQQp9CoVAoFArFNYAS+hQKhUKhUCiuAZTQp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ua/1bJOygaVqMEOJvoJ8Q4jpN0w4JIUKRn81uTdP2lhhf9B3dQNlBTRf0HV0k0nXaCh1t0zStUBpEigU5uLDjVygAFb2ruMQIIUKQee4AFgn7JKdDrdse0p2gGtE0zWS9CQ1B5ut6WQjRzqZb0bpv1jm25dZtA4qi9qqYDda/HYQQ/hdh/pKMR97sX9Y0rZOmaY9qmvaCJtNZlBeI40ij9QLgCfTXNG2gpmmTNU17yTrnVp3+ada/lRZyS1B0422jaZoo42WXnodyAmzsOmvaIU3T7kLexDsg/VsNwEdCiAcu6Cgq+JlomrZC07TeSC1uH+QDTQvgNwembFuKzrm+ZXUSMjnz9da3G202F32mRdq9e5CCv+1nXfQdfVDOd9RLZwlXQwLlCzl+hQJQQp/i0nMf0ofnP6Qjs94rEWuUX3Utsiw0mX9
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"# filter playlists by join with playlist track/artist names\n",
"filtered_playlist = pd.merge(track_frame(playlist.tracks), scrobbles.reset_index(), on=['track', 'artist'])\n",
"# to time series\n",
"filtered_playlist = filtered_playlist.set_index('time')\n",
"# select only descriptor float columns\n",
"filtered_playlist = filtered_playlist.loc[:, float_headers]\n",
"# resample by day and mean\n",
"filtered_playlist = filtered_playlist.resample(\"2W\").mean()\n",
"\n",
"# filtered_playlist[\"energy\"].plot()\n",
2021-02-04 13:34:25 +00:00
"filtered_playlist.plot(lw=3)\n",
2021-02-01 21:43:27 +00:00
"\n",
"plt.title(f\"{playlist_name} Characteristics Over Time\")\n",
"plt.legend(loc = \"upper left\", fontsize = \"x-small\")\n",
"plt.ylim([0, 1])\n",
"plt.grid()\n",
"plt.show()"
]
},
{
"source": [
"# Playlist Comparisons\n",
"\n",
"Comparing different playlists over parameters like listening count, average plays per track and sound characteristics."
2021-02-01 21:43:27 +00:00
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 24,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
"playlist_names = [\"RAP\", \"EDM\", \"ROCK\", \"METAL\", \"JAZZ\", \"POP\"] # super-genres\n",
"# playlist_names = [\"DNB\", \"HOUSE\", \"TECHNO\", \"GARAGE\", \"DUBSTEP\", \"BASS\"] # EDM playlists\n",
"# playlist_names = [\"20s rap\", \"10s rap\", \"00s rap\", \"90s rap\", \"80s rap\"] # rap decades\n",
"# playlist_names = [\"UK RAP\", \"US RAP\"] # UK/US split\n",
"# playlist_names = [\"uk rap\", \"grime\", \"drill\", \"afro bash\"] # british rap playlists\n",
"# playlist_names = [\"20s rap\", \"10s rap\", \"00s rap\", \"90s rap\", \"80s rap\", \"trap\", \"gangsta rap\", \"industrial rap\", \"weird rap\", \"jazz rap\", \"boom bap\", \"trap metal\"] # american rap playlists\n",
"# playlist_names = [\"rock\", \"indie\", \"punk\", \"pop rock\", \"bluesy rock\", \"hard rock\", \"chilled rock\", \"emo\", \"pop punk\", \"stoner rock/metal\", \"post-hardcore\", \"melodic hardcore\", \"art rock\", \"post-rock\", \"classic pop punk\", \"90s rock & grunge\", \"90s indie & britpop\", \"psych\"] # rock playlists\n",
"# playlist_names = [\"metal\", \"metalcore\", \"mathcore\", \"hardcore\", \"black metal\", \"death metal\", \"doom metal\", \"sludge metal\", \"classic metal\", \"industrial\", \"nu metal\", \"calm metal\", \"thrash metal\"] # metal playlists"
]
},
{
"source": [
"Pull and process playlist information.\n",
"\n",
"1. Get live playlist track information from spotify\n",
"2. Filter listening history for these tracks\n",
"3. Calculate various parameters and stats"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"playlists = [get_playlist(i, spotnet) for i in playlist_names] # 1)\n",
2021-02-01 21:43:27 +00:00
"\n",
"# filter playlists by join with playlist track/artist names\n",
"filtered_playlists = [pd.merge(track_frame(i.tracks), scrobbles, on=['track', 'artist']) for i in playlists] # 2)\n",
2021-02-01 21:43:27 +00:00
"\n",
"### STATS, 3) ###\n",
"# number of scrobbles per playlist\n",
2021-02-01 21:43:27 +00:00
"playlist_counts = [i.count()[0] for i in filtered_playlists]\n",
"# total time listenened per playlist\n",
2021-02-01 21:43:27 +00:00
"playlist_time = [i[\"duration_ms\"].sum() for i in filtered_playlists]\n",
"# average track time per playlist\n",
"playlist_average_track_time = [i.drop_duplicates(['uri'])[\"duration_ms\"].mean() for i in filtered_playlists]\n",
"# number of tracks per playlist\n",
"playlist_track_count = np.array([len(i.tracks) for i in playlists])\n",
2021-02-01 21:43:27 +00:00
"\n",
"# distinct on uri\n",
"filtered_playlists = [i.drop_duplicates(['uri']) for i in filtered_playlists]\n",
"# select only descriptor float columns\n",
"filtered_playlists = [i.loc[:, float_headers] for i in filtered_playlists]\n",
"\n",
"playlist_mean = [i.mean() for i in filtered_playlists]\n",
"playlist_std = [i.std() for i in filtered_playlists]"
]
},
{
"source": [
"## Listening Characteristics Over Different Playlists"
],
"cell_type": "markdown",
"metadata": {}
},
2021-02-01 21:43:27 +00:00
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 26,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x480 with 1 Axes>",
2021-02-04 13:34:25 +00:00
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"263.63625pt\" version=\"1.1\" viewBox=\"0 0 373.291974 263.63625\" width=\"373.291974pt\" 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:36:59.976570</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 373.291974 263.63625 \nL 373.291974 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(#p20575d6f4b)\" d=\"M 45.321307 239.758125 \nL 45.321307 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=\"m3aeca3fb5e\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"45.321307\" xlink:href=\"#m3aeca3fb5e\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- acoust -->\n <g transform=\"translate(28.715057 254.356563)scale(0.1 -0.1)\">\n <defs>\n <path d=\"M 34.28125 27.484375 \nQ 23.390625 27.484375 19.1875 25 \nQ 14.984375 22.515625 14.984375 16.5 \nQ 14.984375 11.71875 18.140625 8.90625 \nQ 21.296875 6.109375 26.703125 6.109375 \nQ 34.1875 6.109375 38.703125 11.40625 \nQ 43.21875 16.703125 43.21875 25.484375 \nL 43.21875 27.484375 \nz\nM 52.203125 31.203125 \nL 52.203125 0 \nL 43.21875 0 \nL 43.21875 8.296875 \nQ 40.140625 3.328125 35.546875 0.953125 \nQ 30.953125 -1.421875 24.3125 -1.421875 \nQ 15.921875 -1.421875 10.953125 3.296875 \nQ 6 8.015625 6 15.921875 \nQ 6 25.140625 12.171875 29.828125 \nQ 18.359375 34.515625 30.609375 34.515625 \nL 43.21875 34.515625 \nL 43.21875 35.40625 \nQ 43.21875 41.609375 39.140625 45 \nQ 35.0625 48.390625 27.6875 48.390625 \nQ 23 48.390625 18.546875 47.265625 \nQ 14.109375 46.140625 10.015625 43.890625 \nL 10.015625 52.203125 \nQ 14.9375 54.109375 19.578125 55.046875 \nQ 24.21875 56 28.609375 56 \nQ 40.484375 56 46.34375 49.84375 \nQ 52.203125 43.703125 52.203125 31.203125 \nz\n\" id=\"DejaVuSans-97\"/>\n <path d=\"M 48.78125 52.59375 \nL 48.78125 44.1875 \nQ 44.96875 46.296875 41.140625 47.34375 \nQ 37.3125 48.390625 33.40625 48.390625 \nQ 24.65625 48.390625 19.8125 42.84375 \nQ 14.984375 37.3125 14.984375 27.296875 \nQ 14.984375 17.28125 19.8125 11.734375 \nQ 24.65625 6.203125 33.40625 6.203125 \nQ 37.3125 6.203125 41.140625 7.25 \nQ 44.96875 8.296875 48.78125 10.40625 \nL 48.78125 2.09375 \nQ 45.015625 0.34375 40.984375 -0.53125 \nQ 36.96875 -1.421875 32.421875 -1.421875 \nQ 20.0625 -1.421875 12.78125 6.34375 \nQ 5.515625 14.109375 5.515625 27.296875 \nQ 5.515625 40.671875 12.859375 48.328125 \nQ 20.21875 56 33.015625 56 \nQ 37.15625 56 41.109375 55.140625 \nQ 45.0625 54.296875 48.78125 52.59375 \nz\n\" id=\"DejaVuSans-99\"/>\n <path d=\"M 30.609375 48.390625 \nQ 23.390625 48.390625 19.1875 42.75 \nQ 14.984375 37.109375 14.984375 27.296875 \nQ 14.984375 17.484375 19.15625 11.84375 \n
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAm0AAAG5CAYAAADcTAMaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOydd3hT1fvAPydJ925pS9l7D2WUTdlbQMCFylBUXLgn/vy6F+JAcSuoFBQRBAVUZJQ9ZcoeZbalpXunyfn9cdMkbdNJJ5zP8+RJzrnnnPve2zR5c94lpJQoFAqFQqFQKKo3uqoWQKFQKBQKhUJRPEppUygUCoVCoagBKKVNoVAoFAqFogaglDaFQqFQKBSKGoBS2hQKhUKhUChqAEppUygUCoVCoagBKKVNoVAoFAqFogaglDaFQqFQKBSKGoBS2hQKhUKhUChqAEppUygUCoVCoagBKKVNoVAoFAqFogaglDaFQlFtEUI0EkJIIcT8Sj7vFMt5p+TrjxRCRFamLNcLQoh+lnv+SlXLolBUV5TSplAUghBipuVLRAohWla1PNcKdvc092ESQsQJIdYJISZWtXwVieV6N5Rh3nwH9yxJCHFKCPGbEOIRIURABYhcIynrfVYoqjuGqhZAoaiOCCEEMA2QgADuA56uUqGuPV61PDsBrYAxQH8hRBcp5ZNVJ1aRDKzi8y8H9lleewH1gT5o9+5NIcRjUsr5VSPaVbMTaA3EVbUgCkV1RSltCoVjhgCNgPnAMGCyEOJFKWV2VQp1LSGlfMW+LYQYCKwBHhdCzJFSRlaFXEUhpTxVxSL8ll8pE0IYgHuAj4F5QogsKeWiqhDuapBSpgNHq1oOhaI6o8yjCoVj7rM8fw2EA7WAm+0HCCH+tJhhOjpaQAhxm+X4+/n6/YUQbwshjgghMixmrrVCiCEO1rD6VgkhhgkhNljGS7sxY4UQC4QQx4UQaZbHHiHEDCGEw/9xIUQLIcSvQogEy/itQoiRhflyWebUE0J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2lLOxeVwR1LM+xlmc/NEUuEJuSXCRSyqVCiFFou073YNmdFELsQXMZWGMZ6mt5vlhgkaJx+F4uAQXuo5QyRwgRBwSVYp3c/4GoQo5HAQ3Qrs9eabsspSzO11KhqFCUeVShsCCECERzrAdYlC/yTGIzW96fb+oPaIrRbZZ2bgDC9/nG5X4BPCalFEU8pjoQr7Avi2loCturUspuUsqHpJQvSS2dxs8OxidbnoMdHCusP1fuMcXI/aqDueWOxSw3A83xv6WU8i4p5XNSylcs1+0wmEBKuQPYixaQ4IctAGGe3c5pqZFSZljO3QLty/4utB2gu7Ao95WB0CKF+1qaOyzPuX+7vcX87fIo0FLKlVLKAWhK30DgQ7RAjz+EEG0swxItz/Y7uSWhrIpPgfem0NKd1ML2vi4JufekdiHHQ/KNy0UpbIoqRyltCoWNyWgRYnuAbwt5xAKDhBCN7eb9gOYHM1kI4YQWSRhHXnMpwHbLc59ylLmZ5flXB8fCHPTtszz3EI7TgfR20FcRcl8NTdA+u/6WUqbYHxBauo8mRcz9DM1vcBKa8i2Br8pLMCnleSllOJpP3Umgt8hbqcBMXjNueTIFTWmMQjNpIqVMRfPxayuE8C/tglLKNCnlOqklO34L7f9juOXwTrTr6SuEyG+SrwgcvZ97o93Pvfn6i7rPuWP75T8ghGgG1APOWPxMFYpqhVLaFAobuUEGD0kppzl6oDnv5wYrANoXNZp/THc0c2QgsDD/7o2Ucjeav9M4IYRDx2khRHvLTlJJibQ898u3zo3YnLTtZTiHFo3XjIJO+cMo6M8GWhb+U8DDQogRhcjdw+I/VRlEWp57CyGsX8xCCE+0vHpFuX0sRNtBeRZNCVgjpTxdVkGEEIFCiPYODnmgmYtzyOtfdwW
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
2021-02-04 13:34:25 +00:00
"x_pos = np.arange(len(float_headers))\n",
"for idx, mean in enumerate(playlist_mean):\n",
" plt.plot(x_pos, mean, lw=2)\n",
2021-02-01 21:43:27 +00:00
" \n",
"plt.legend(playlist_names)\n",
"plt.xticks(x_pos, [i[:6] for i in float_headers])\n",
"plt.ylim([0, 1])\n",
2021-02-01 21:43:27 +00:00
"plt.title('Average Playlist Descriptor')\n",
"plt.grid()\n",
"plt.show()"
]
},
{
"source": [
"## Time Spent Listening To Each"
],
"cell_type": "markdown",
"metadata": {}
},
2021-02-01 21:43:27 +00:00
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 27,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 720x480 with 1 Axes>",
2021-02-04 13:34:25 +00:00
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"277.314375pt\" version=\"1.1\" viewBox=\"0 0 388.892187 277.314375\" width=\"388.892187pt\" 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:37:00.710512</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 277.314375 \nL 388.892187 277.314375 \nL 388.892187 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 46.892188 239.758125 \nL 381.692187 239.758125 \nL 381.692187 22.318125 \nL 46.892188 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#pf49252de21)\" d=\"M 46.892188 229.874489 \nL 188.317026 229.874489 \nL 188.317026 202.609285 \nL 46.892188 202.609285 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#pf49252de21)\" d=\"M 46.892188 195.792984 \nL 365.74933 195.792984 \nL 365.74933 168.52778 \nL 46.892188 168.52778 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#pf49252de21)\" d=\"M 46.892188 161.711479 \nL 112.53791 161.711479 \nL 112.53791 134.446275 \nL 46.892188 134.446275 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#pf49252de21)\" d=\"M 46.892188 127.629975 \nL 84.438033 127.629975 \nL 84.438033 100.364771 \nL 46.892188 100.364771 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#pf49252de21)\" d=\"M 46.892188 93.54847 \nL 95.652632 93.54847 \nL 95.652632 66.283266 \nL 46.892188 66.283266 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#pf49252de21)\" d=\"M 46.892188 59.466965 \nL 60.002993 59.466965 \nL 60.002993 32.201761 \nL 46.892188 32.201761 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <path clip-path=\"url(#pf49252de21)\" d=\"M 46.892188 239.758125 \nL 46.892188 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=\"m76cfb823dd\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"46.892188\" xlink:href=\"#m76cfb823dd\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <g transform=\"translate(43.710938 254.356562)scale(0.1 -0.1)\">\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74.21875 3
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAogAAAHRCAYAAADpIEgYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAA1dUlEQVR4nO3deZhkVX3/8fcnIEKEQRQRXFHUqBhXZNwB4xowoOIKKJqgEfctiv4U3DExikuIiguiQWVRARFFBBREJRg0oBhEGEEQ2cQB2QS+vz/Oba1bVG8z3VPdM+/X89RTU+eee++p0zUznz7nnlupKiRJkqQJfzXuBkiSJG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nlTVTcDf+xeZkSVbUaUPYY2YnX6QNkPu+fZrGxdETcx5lHF7lqt46vqdbTpunWAwdueTEzfjmrnquqnlVZthfy5wJ0z+ls5HjPLQ07aL91I26+6c917xL7bdc+jVsHPl3sBV1TViSO2jfp7MeFzwDW0kcPn0EY9Pz3JtP6sreTnb/A4N1bVj6vq/bSV19BWQGsNZ0CUFrYPdc8HJLnT8MYkt+mmwKaVdt/CzSfZtjNwX9oK5DNHVHlbBr6WrLvtyfu6l58dqPdZ2tTl3t0U1vB5/mr4vm4r6HLatZfrzcGxZizJ47qR02ETo2jXDJRNTPnfbbhyVZ1Gu7XNM5K8eHh7d66/TbLJqG1jcBDt/4v3pZvLBkhyV/5yy6GZmrRfOp+h/ZLyb4MLtpJsTFtNPVFnVVkG3C7JAwcLu1G2J0+2U3cZycG06yXfTQtsK7U4Za4+f0keloH7i05zHK2hvAZRWsCq6jtJ3kwLY79M8g3aSuj1afex24a2SOApMzj
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"plt.barh(np.arange(len(playlist_names)), np.array(playlist_time) / (1000 * 60 * 60 * 24) )\n",
"plt.yticks(np.arange(len(playlist_names)), labels=playlist_names)\n",
"plt.xlabel(\"Time (Days)\")\n",
"plt.grid(axis=\"x\")\n",
"plt.title(\"Time Spent Listening to Playlists\")\n",
"plt.show()"
]
},
{
"source": [
"## Normalised\n",
"\n",
"Below normalises the above chart by dividing through by the average track length multiplied by the number of tracks per playlist. The units are essentially average plays per song. The existing data could be described as:\n",
"\n",
"*number of plays \\* track time \\* number of songs in playlist*\n",
"\n",
"By normalising by the last two terms, we get the average number of plays per song."
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 28,
"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=\"277.314375pt\" version=\"1.1\" viewBox=\"0 0 388.892188 277.314375\" width=\"388.892188pt\" 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:37:01.279204</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 277.314375 \nL 388.892188 277.314375 \nL 388.892188 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 46.892188 239.758125 \nL 381.692187 239.758125 \nL 381.692187 22.318125 \nL 46.892188 22.318125 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p17e3518387)\" d=\"M 46.892188 229.874489 \nL 338.296724 229.874489 \nL 338.296724 202.609285 \nL 46.892188 202.609285 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p17e3518387)\" d=\"M 46.892188 195.792984 \nL 365.74933 195.792984 \nL 365.74933 168.52778 \nL 46.892188 168.52778 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p17e3518387)\" d=\"M 46.892188 161.711479 \nL 197.623522 161.711479 \nL 197.623522 134.446275 \nL 46.892188 134.446275 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p17e3518387)\" d=\"M 46.892188 127.629975 \nL 146.250776 127.629975 \nL 146.250776 100.364771 \nL 46.892188 100.364771 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p17e3518387)\" d=\"M 46.892188 93.54847 \nL 206.194601 93.54847 \nL 206.194601 66.283266 \nL 46.892188 66.283266 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p17e3518387)\" d=\"M 46.892188 59.466965 \nL 228.531333 59.466965 \nL 228.531333 32.201761 \nL 46.892188 32.201761 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <path clip-path=\"url(#p17e3518387)\" d=\"M 46.892188 239.758125 \nL 46.892188 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=\"mfea45cd8fe\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"46.892188\" xlink:href=\"#mfea45cd8fe\" y=\"239.758125\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <g transform=\"translate(43.710938 254.356562)scale(0.1 -0.1)\">\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAogAAAHRCAYAAADpIEgYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAA5cUlEQVR4nO3deZglZX238fsrA4LCIIqIGhUFfaMQl7iMO7ihRgwuoMgggglR0UTcxV0Td6OIxBhxQVQQBBUEF0RZRFCCcQMXBBlZFNkZUUCB3/vHU62nDqd7uoeeOX2G+3Nd56o5VU9V/ar6zPR3nnqqTqoKSZIkacotxl2AJEmSFhYDoiRJknoMiJIkSeoxIEqSJKnHgChJkqQeA6IkSZJ6DIiSJEnqMSBKkiSpx4AoSZKkHgOiJEmSegyIkiRJ6jEgSlrQkixLsmxo3m5JKslu46mqb1SNK2hfSY4fmveWbv4281vd6pPkgO4YNht3LbO10D5L0kJhQJQWoO4XViX5dZJ1p2mzrGuzaHXXp4VnEsPZ6pBkm+68vGXctUiTxIAoLWx3BfYadxEL0BeBe3fTNcV+tGM6ddyF3AR7047hgnEXMgdr4mdJusnseZAWrsuBAl6b5GNVdcm4C1ooqupK4Mpx1zGfup/vRP+Mq+q3wG/HXcdcrImfJWk+2IMoLVx/BP4d2BB481xWTPKsJCcmuTLJ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nhaKzu3m71NVlw8c09eTvALYg9bLtg4tDO3XLT8/yQNpIfeZtMeqrEV73M9Pab2qP1lFxzEnVXV1ksfQesx3AF5G+7m8g9YT+jT+OlZxRdu6PsnTgXfRHmS9ARBaIFttY/6q6t1d0P832udze9p/kC6g/ef
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"plt.barh(np.arange(len(playlist_names)), np.array(playlist_time) / (playlist_track_count * playlist_average_track_time) )\n",
"plt.yticks(np.arange(len(playlist_names)), labels=playlist_names)\n",
"plt.xlabel(\"Average plays per song\")\n",
"plt.grid(axis=\"x\")\n",
"plt.title(\"Normalised listening time\")\n",
"plt.show()"
]
},
2021-02-01 21:43:27 +00:00
{
"source": [
"# Imports & Setup"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 2,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime\n",
"\n",
"from google.cloud import bigquery\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"mpl.rcParams['figure.dpi'] = 120\n",
2021-02-01 21:43:27 +00:00
"\n",
"from analysis.net import get_spotnet, get_playlist, track_frame\n",
"from analysis.query import *\n",
"from analysis import spotify_descriptor_headers, float_headers, days_since\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"client = bigquery.Client()\n",
"spotnet = get_spotnet()\n",
"cache = 'query.csv'\n",
"first_day = datetime(year=2017, month=11, day=3)"
]
},
{
"source": [
"## Read Scrobble Frame"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
2021-02-04 13:34:25 +00:00
"execution_count": 3,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
"scrobbles = get_query(cache=cache)"
2021-02-01 21:43:27 +00:00
]
},
{
"source": [
"## Write Scrobble Frame"
],
"cell_type": "markdown",
"metadata": {}
},
{
"source": [
"scrobbles.reset_index().to_csv(cache, sep='\\t')"
2021-02-01 21:43:27 +00:00
],
"cell_type": "code",
"metadata": {},
"execution_count": 6,
2021-02-01 21:43:27 +00:00
"outputs": []
}
]
}