2021-02-01 21:43:27 +00:00
{
"cells": [
{
2021-02-20 00:16:03 +00:00
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
2021-02-03 16:08:06 +00:00
"# Artist Investigations"
2021-02-20 00:16:03 +00:00
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 5,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
2021-02-20 00:16:03 +00:00
"output_type": "stream",
2021-02-01 21:43:27 +00:00
"text": [
2021-02-20 00:16:03 +00:00
"538 scrobbles\n",
"1 days spent listening since Nov. 2017\n",
"1.52 minutes/day\n"
2021-02-01 21:43:27 +00:00
]
},
{
"data": {
2021-02-20 00:16:03 +00:00
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>acousticness</th>\n",
" <th>danceability</th>\n",
" <th>duration_ms</th>\n",
" <th>energy</th>\n",
" <th>instrumentalness</th>\n",
" <th>key</th>\n",
" <th>liveness</th>\n",
" <th>loudness</th>\n",
" <th>mode</th>\n",
" <th>speechiness</th>\n",
" <th>tempo</th>\n",
" <th>time_signature</th>\n",
" <th>valence</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>0.175862</td>\n",
" <td>0.548939</td>\n",
" <td>201665.648752</td>\n",
" <td>0.672660</td>\n",
" <td>0.139468</td>\n",
" <td>5.715931</td>\n",
" <td>0.261474</td>\n",
" <td>-5.605276</td>\n",
" <td>0.573896</td>\n",
" <td>0.151126</td>\n",
" <td>110.033599</td>\n",
" <td>3.990403</td>\n",
" <td>0.301708</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>0.185824</td>\n",
" <td>0.118423</td>\n",
" <td>68133.871857</td>\n",
" <td>0.136468</td>\n",
" <td>0.280774</td>\n",
" <td>3.886356</td>\n",
" <td>0.215839</td>\n",
" <td>2.190490</td>\n",
" <td>0.494984</td>\n",
" <td>0.141012</td>\n",
" <td>27.453952</td>\n",
" <td>0.394559</td>\n",
" <td>0.169343</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>0.001230</td>\n",
" <td>0.174000</td>\n",
" <td>33568.000000</td>\n",
" <td>0.330000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.059200</td>\n",
" <td>-14.841000</td>\n",
" <td>0.000000</td>\n",
" <td>0.028200</td>\n",
" <td>51.466000</td>\n",
" <td>1.000000</td>\n",
" <td>0.055700</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>0.035800</td>\n",
" <td>0.475000</td>\n",
" <td>147430.000000</td>\n",
" <td>0.551000</td>\n",
" <td>0.000114</td>\n",
" <td>2.000000</td>\n",
" <td>0.095200</td>\n",
" <td>-6.829000</td>\n",
" <td>0.000000</td>\n",
" <td>0.049600</td>\n",
" <td>86.711000</td>\n",
" <td>4.000000</td>\n",
" <td>0.188000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>0.093700</td>\n",
" <td>0.548000</td>\n",
" <td>203882.000000</td>\n",
" <td>0.683000</td>\n",
" <td>0.001660</td>\n",
" <td>6.000000</td>\n",
" <td>0.171000</td>\n",
" <td>-5.219000</td>\n",
" <td>1.000000</td>\n",
" <td>0.087700</td>\n",
" <td>109.862000</td>\n",
" <td>4.000000</td>\n",
" <td>0.263000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>0.278000</td>\n",
" <td>0.599000</td>\n",
" <td>250200.000000</td>\n",
" <td>0.761000</td>\n",
" <td>0.089300</td>\n",
" <td>9.000000</td>\n",
" <td>0.356000</td>\n",
" <td>-4.477000</td>\n",
" <td>1.000000</td>\n",
" <td>0.255000</td>\n",
" <td>133.687000</td>\n",
" <td>4.000000</td>\n",
" <td>0.431000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>0.884000</td>\n",
" <td>0.825000</td>\n",
" <td>626166.000000</td>\n",
" <td>0.910000</td>\n",
" <td>0.914000</td>\n",
" <td>11.000000</td>\n",
" <td>0.783000</td>\n",
" <td>-0.507000</td>\n",
" <td>1.000000</td>\n",
" <td>0.518000</td>\n",
" <td>168.266000</td>\n",
" <td>5.000000</td>\n",
" <td>0.718000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
2021-02-01 21:43:27 +00:00
"text/plain": [
" acousticness danceability duration_ms energy instrumentalness \\\n",
2021-02-04 13:34:25 +00:00
"mean 0.175862 0.548939 201665.648752 0.672660 0.139468 \n",
"std 0.185824 0.118423 68133.871857 0.136468 0.280774 \n",
"min 0.001230 0.174000 33568.000000 0.330000 0.000000 \n",
"25% 0.035800 0.475000 147430.000000 0.551000 0.000114 \n",
"50% 0.093700 0.548000 203882.000000 0.683000 0.001660 \n",
"75% 0.278000 0.599000 250200.000000 0.761000 0.089300 \n",
"max 0.884000 0.825000 626166.000000 0.910000 0.914000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" key liveness loudness mode speechiness tempo \\\n",
2021-02-04 13:34:25 +00:00
"mean 5.715931 0.261474 -5.605276 0.573896 0.151126 110.033599 \n",
"std 3.886356 0.215839 2.190490 0.494984 0.141012 27.453952 \n",
"min 0.000000 0.059200 -14.841000 0.000000 0.028200 51.466000 \n",
"25% 2.000000 0.095200 -6.829000 0.000000 0.049600 86.711000 \n",
"50% 6.000000 0.171000 -5.219000 1.000000 0.087700 109.862000 \n",
"75% 9.000000 0.356000 -4.477000 1.000000 0.255000 133.687000 \n",
"max 11.000000 0.783000 -0.507000 1.000000 0.518000 168.266000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" time_signature valence \n",
2021-02-04 13:34:25 +00:00
"mean 3.990403 0.301708 \n",
"std 0.394559 0.169343 \n",
"min 1.000000 0.055700 \n",
"25% 4.000000 0.188000 \n",
"50% 4.000000 0.263000 \n",
"75% 4.000000 0.431000 \n",
"max 5.000000 0.718000 "
2021-02-20 00:16:03 +00:00
]
2021-02-01 21:43:27 +00:00
},
2021-02-20 00:16:03 +00:00
"execution_count": 5,
2021-02-01 21:43:27 +00:00
"metadata": {},
2021-02-20 00:16:03 +00:00
"output_type": "execute_result"
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-02-04 13:34:25 +00:00
"artist_name = \"Flume\".lower()\n",
2021-02-03 16:08:06 +00:00
"artist_frame = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name] # FILTER SCROBBLES\n",
2021-02-01 21:43:27 +00:00
"artist_frame = artist_frame.sort_index(ascending=False) # SORT\n",
"# artist_frame = artist_frame.loc[:, descriptor_headers] # DESCRIPTORS\n",
"\n",
"total_time = artist_frame[\"duration_ms\"].sum() / (1000 * 60) # minutes\n",
"total_days = total_time / (60 * 24) # days\n",
"print(f'{artist_frame.count()[0]:,d} scrobbles')\n",
"print(f'{total_days:.0f} days spent listening since Nov. 2017')\n",
"print(f'{total_time / days_since(first_day).days:.2f} minutes/day')\n",
"\n",
"artist_frame.describe()[1:]"
]
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 6,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-02-20 00:16:03 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAHmCAYAAADZdELPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AACUtElEQVR4nO2dd5gb53X1zwUW23e57FWiREq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1CCCGEkEK0wppFfJ9SarDYyg0nzGCJsrvqvROEEEIIISXwCgC/KLZSIwqzgwDw4x//GJdccklVNjAyMoL169dj9erV6O7urso2CKkHPLZJM8PjmwSRzZs343Wvex1g65diNKIwiwPAokWLsGzZsqpsYGhoCEePHsXSpUvR29tblW0QUg94bJNmhsc3CSIjIyP6R0/lVyz+J4QQQggJCBRmhBBCCCEBgcKMEEIIISQgUJgRQgghhAQECjNCCCGEkIBAYUYIIYQQEhAozAghhBBCAgKFGSGEEEJIQKAwI4QQQggJCBRmhBBCCCEBgcKMEEIIISQgUJgRQgghhAQECjNCCCmBaGICTx4cQCql6r0rhJAmhMKMEEJK4L0/eQKv+NpD+J8H9tR7VwghTQiFGSGElMDWw4MAgM32d0II8RMKM0IIKYH4RAoAEEtM1HlPCCHNCIUZIYSUQCxpCbNxCjNCSBWgMCOEkBKIa2EWpzAjhPgPhRkhhHhEKeVEzKKJVJ33hhDSjFCYEUKIRxITaYuMKFOZhJAqQGFGCCEe0YX/AGvMCCHVgcKMEEI8ouvLAEbMCCHVgcKMEEI8YgozRswIIdWAwowQQjySGTFLcSwTIcR3KMwIIcQj8YnMKFksyc5MQoi/UJg
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
2021-02-20 00:16:03 +00:00
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-02-03 16:08:06 +00:00
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
2021-02-01 21:43:27 +00:00
"# resample by day and mean\n",
2021-02-03 16:08:06 +00:00
"filtered_artist = filtered_artist.resample(\"2W\").count()\n",
2021-02-01 21:43:27 +00:00
"\n",
"filtered_artist[\"energy\"].plot()\n",
"\n",
"plt.title(f\"{artist_name} Scrobbles\")\n",
"plt.grid()\n",
"plt.show()"
]
},
2021-02-04 13:34:25 +00:00
{
2021-02-20 00:16:03 +00:00
"cell_type": "markdown",
"metadata": {},
2021-02-04 13:34:25 +00:00
"source": [
"## Average Descriptor\n",
"\n",
"Below presents the average descriptor for the artist. \"*All Listened Tracks*\" describes the descriptor based on the listening activity for this artist. This takes into account how many times a track is listened to. \"*Distinct Tracks*\" takes only the distinct set of tracks that have been listened to and takes that average.\n",
"\n",
"The difference between them could be described as which features are preferred for an artist. If the blue bar is higher than the red, it would indicate that tracks from this artist which have a higher value for this are listened to more. "
2021-02-20 00:16:03 +00:00
]
2021-02-04 13:34:25 +00:00
},
2021-02-01 21:43:27 +00:00
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 7,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-02-20 00:16:03 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAG5CAYAAAAzjmgkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AABM3klEQVR4nO3deXxU1f3/8dcnLAEMm4IsIoLgggiiKCgFRVCRstQFi2tFq2D50cq3rXUBMWCtaC2tUlGpC4pYRFRc2RRxreBXyxdRXAAjKiAoazSCkPP749yJN5NJMpkkk0t4Px+PeUxy7jnnnntyZ+aTc869Y845RERERCS6Mqq6ASIiIiJSMgVsIiIiIhGngE1EREQk4hSwiYiIiEScAjYRERGRiFPAJiIiIhJxCthEREREIk4Bm4iIiEjEKWATERERiTgFbCIiIiIRp4BNREREJOIUsImUgZn9zsw+NLM8M3NmNjpId2a2uGpbJxJ9ZpZjZjlV3Q6RvY0CNpEkmdn5wJ3AD8A/gPHA21XZpqpiZguDIPULM6tR1e2pDsysd9Cn4cf3ZrbezF4zs7+a2bFV3c6oMLNpQR+1qeq2iKRDzapugMheZGDs2Tm3rkpbUoXM7FCgL+CAVkB/4PkqbVT18jkwLfi5NtAUOA74I/BHM3sMGOGcy62a5pVb36pug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AycPf3+1cyjlPmzF7GMaxd93KjvY1jvBtk5B2c/x9xjbjL8P2X1An1KOOQNYG9TduZS89fCjPLuAA0PpPfnpHluTS6mjDX7U6lP8zWu34z9opwNnJdsfoTwD8QHFjqBtC/BXjA4Lyg5LUKY//ma73+NHFZ/BB1zPB2UaVWQfh+qInRPhRx4+aHwNH0R
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-04 13:34:25 +00:00
},
"metadata": {
"needs_background": "light"
2021-02-20 00:16:03 +00:00
},
"output_type": "display_data"
2021-02-04 13:34:25 +00:00
}
],
"source": [
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
"filtered_artist_no_dup = filtered_artist.drop_duplicates(['uri'])\n",
"\n",
"filtered_artist_no_dup = filtered_artist_no_dup.loc[:, float_headers].mean()\n",
"filtered_artist_dup = filtered_artist.loc[:, float_headers].mean()\n",
"\n",
"x = np.arange(len(float_headers))\n",
"width = 0.35\n",
"plt.bar(x - width/2, filtered_artist_no_dup, width, label='All Listened Tracks')\n",
"plt.bar(x + width/2, filtered_artist_dup, width, label='Distinct Tracks', color=(1, 0, 0))\n",
"\n",
"plt.title(f\"{artist_name} Average Descriptor\")\n",
"plt.legend(['All Listened Tracks', 'Distinct Tracks'])\n",
"plt.xticks(x, labels=[i[:6] for i in float_headers])\n",
"plt.ylim([0, 1])\n",
"plt.grid(axis='y')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 8,
2021-02-04 13:34:25 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-02-20 00:16:03 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAHmCAYAAADOVtIGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOydZ3gUVduA77Ob3ui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qJmR8Zrr+XC2jLGOCrXi5ExiGOR7wvctLh96TC2EvI+NI3sCQCyKiyXnVhuCwtn2aPpkON1xPFakZfXryiDKIVNURrJcBsZnd/lC+H4GRfrclo+goVtitUOoBcy9s1tJSVsrrenkIpVd0f3mTDIqsy6VCfyIUhlbbGmaeMd5gtBf5OKtv2uQf7J+Aw+0DTNMHs2G3KlCGialoSMp5suhKiF/LzGIV2ydZGxTXkl2vbbpfdE07RI4GGbtbQ50Bd4ApkcY0LGqGXH37bffYQQ5hwsc/1sv7c6yH9GJgE8IIT4L1IpuQ3Yr2nafoexMci4vIrkjpJQ+80V8vr6FWUQFcOmKI3csP02shJ0LITjZ3RhyM+NOoOMeLPnbVmAThGyHlteqY+8Hqw1UNZq2rbnloa238sNtvU2kB1DKiithWulTzKUCUdLIUi3ppWC+QxcRtO0c5qmfcvNUiw9bfF0GVgxXq8zMl5HL5t72dV1aJqmHdY07WOktQtkVm1O/Ilcd3Vk9qchQtZiG4a0Gi1yOHYS8INtjn5Iy6MHeusayO9KBdt8ZZGy/voVuUApbIrSSEYM0oSsQiFEK2Q8lbv5BOn2+0AIoStmK2TdLlcVie+R7slGwAqbZcpovieA9/Kx5gjb755Zg6KFEAHAAvJmjc+Ys09
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
2021-02-20 00:16:03 +00:00
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-02-03 16:08:06 +00:00
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
2021-02-01 21:43:27 +00:00
"# select only descriptor float columns\n",
"filtered_artist = filtered_artist.loc[:, float_headers]\n",
"# resample by day and mean\n",
"filtered_artist = filtered_artist.resample(\"1M\").mean()\n",
"\n",
"# filtered_playlist[\"energy\"].plot()\n",
2021-02-04 13:34:25 +00:00
"filtered_artist.plot(lw=3)\n",
2021-02-01 21:43:27 +00:00
"\n",
"plt.title(f\"{artist_name} Characteristics Over Time\")\n",
"plt.legend(loc = \"upper left\", fontsize = \"xx-small\")\n",
"plt.ylim([0, 1])\n",
"plt.grid()\n",
"plt.show()"
]
},
{
2021-02-20 00:16:03 +00:00
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"# Artist Listening Time"
2021-02-20 00:16:03 +00:00
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 9,
2021-02-03 16:08:06 +00:00
"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)"
]
},
{
2021-02-20 00:16:03 +00:00
"cell_type": "markdown",
"metadata": {},
2021-02-03 16:08:06 +00:00
"source": [
"For these charts the ordering is left as retrieved from the API, i.e by most played."
2021-02-20 00:16:03 +00:00
]
2021-02-03 16:08:06 +00:00
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 10,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-02-20 00:16:03 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1UAAAOACAYAAADSDFlaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AADpMUlEQVR4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0rONz7Ha6F6b8tTK40nP8jqljRhWrHH+M6V6FdeTphfuq/Sg5eWBnYEnI+LJjsTbQfVsUFFR+b6M6cJ4zLo9J1VmZtbZHgaWyv+1u9uIiKkR8WBEnMjMdV+7FapU/nhckNk9SlrvsmUXhvhfUvKwSd4FsB7/zsetq5zbgur30pqngM90cHvs9/Ox6rzFBlUeuLtzO+p25e/qMuBx0u6YG5ZPRsT7pGdbrSxpjSrXV5LvfxcL8/qya0g7In6NtEbvU8zZUapFSSO600ibo7RlrXx8oqtiMpsbOKkyM7POVhmxuKDaM4Hys4k2KZd3BUmbSVqsyqnKyM6HhbLKVMTZFtznzQX+Dmwo6YTSxhyVvvpIWrVcXq+8XuYvpFGMP1eLW9JnJK1TKBqUj78uPr8o/2F8agfCGEb622Dj8glJ35e0fY1nZa0IHJTfDu9Av235G2la4Aml+6/0/9nC23NIa/rOlDTb9u+SFs5TQjssrxk7mpRA1vqcL87nTy9+XyQtC5xQqFM2KB/3z69PSN+9OWUv0qju7W1sUFFR+bc8tNVaZvM4r6kyM7NOFRH3SPol6Y/NFyXdRtpBcAlgFdKoyv3ATu1odgtJg2qc+3dE/LnGuWOA7SRVdjGcBKxLGvEYT3qWUcVQ0mjUqZLWy+eJiN/l84eR1judDOwn6X7SWqaVSJtHbEQauXi
"text/plain": [
"<Figure size 840x1050 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
2021-02-20 00:16:03 +00:00
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-02-03 16:08:06 +00:00
"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",
2021-02-03 16:08:06 +00:00
"plt.title(\"Time Listened (Since Nov 17)\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 11,
2021-02-03 16:08:06 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-02-20 00:16:03 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1wAAAOACAYAAAAuGXKQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAABJ0AAASdAHeZh94AADs5UlEQVR4nOzdebxVVf3/8ddbc0oEZy0rUTTH1PpZZE5oOWU5pDY4oqWmWTmlWQ5kfh3SUstIc0LMOecZBxDU1DAtp5wQxxBQ4IoCKnx+f6x1YLM55w7cc+65wPv5eJzHuWfttdf+7HNvj/i41vpsRQRmZmZmZmZWfws1OwAzMzMzM7P5lRMuMzMzMzOzBnHCZWZmZmZm1iBOuMzMzMzMzBrECZeZmZmZmVmDOOEyMzMzMzNrECdcZmZmZmZmDeKEy8zMzMzMrEGccJmZmZmZmTWIEy4zMzMzM7MGccJlZmZmZmbWIE64zMzMqpA0WtLoUlt/SSGpf3Oiml21GNvoH5KGldoG5PZ+9Y2u60galO+hd7Njaa/u9rdkZo3jhMvMzGbK/wAMSa9KWrxGn9G5zye6Oj7rfubFZKcrSOqXv5cBzY7FzJrLCZeZmVXzOeDwZgfRDd0IrJPf5xfnke7psWYH0gnHke7hzWYH0gHz49+SmVXh/zppZmZlE4AAfinpoogY3+yAuouImARManYc9ZR/v/P07zgi/gf8r9lxdMT8+LdkZtV5hsvMzMo+AH4L9AJO6siJkr4rabikSZKmSHpK0nGSFqvSd3R+9ZT0h/zzR5UlWIXjPSSdLen1POaTknbJfT4h6deSXpQ0VdLLkg6rcq1FJR0m6Y68XHKapHcl3Stphw7cX9V9N5I2kHRVjneapHGS/iXpHEmLlPp+QtKhkh6R1CLpA0lP5Pjm+P9lJYdJeibf45uSzpPUq71xt3FPVfdwSdpc0q2S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Pcj4v6IOJJUcXJRUvXJispyvWqxPJLfO1LhrykiVeobBaxSLC9f0NY+xrLWvpeu8giwTF5Oa2ZN4oTLzMza42RSsvBrqi//uiS/Hy+psi+HvIH/LNL/31zc4BhbMxpYNpdwn0nSD0kV6+aapK9JWqLKocqMyAcws4DIn0izfX+sdo6kT5Vmjwbl919LWrbQb3FSxb6GkLRFnkErm+2esspStM+VO0fESFIp+O9IOqB8PF/rC5JW7Ey8dTSY9Ld6mgqb7CR9Fji8g2PV/F660Nn5/UJJny4flLRkXm5rZg3kPVxmZtamiHg3P2frdzWOPyzpd8AxwNN539f7pJmQ9UkFB87sqnirOIeUWD0o6VrSUquNSbMWfyftvZpbxwBbS6pUkZtMWnq3AzCBWZX1IC013BD4MfBtSfeTChysSNrbtSkpqX0WICIekvQn0sxi5XutPIdrArX3zHXWH0kzPQ+RktUPgf8HbE2q+lesOHgfqRjJhZKuB94jFX04Lx/fk7R/7mJJPyMt4ZxImvXcgPT3sQnp+VDN9jvSc8W+D6wlaQhpH913geH52Ix2jvU86Xf7fUkfkb63AC7vqiV8EXGfpF+SkvMXJd1B+hvtQXo+2Zak/21u3xXxmC2onHCZmVl7/ZH0wNXe1Q5GxLGSniA9MHlf0ub9l0n7p34fcz70uMtExF2Svp1j+R5puddjpOcUrU7nEq6BpOSnLymB+wTwRm7/ffEf1xHxkaRdgL1Jz0H6Fukfv+NI/xA+gVQhsOjnwAvAT0jFK94BbgR+Bfy7E3G35lRgV1JS+g1SkvFabj8nIiYU7uluSUcBB5JmgRYlJRfn5eNvSPp/pKRxN1IZ8oVJ5fGfJc36PdWg++iQiJgiaSvSjO7uwBGk38uppJm6XZi116utsaZL2hU4nfRg4qUAkRKcLtszFRFn5MT5Z6S/z51J/8HhTdJ/DLiyq2IxW1Cp9eJQZmZ
"text/plain": [
"<Figure size 840x1050 with 1 Axes>"
]
2021-02-03 16:08:06 +00:00
},
"metadata": {
"needs_background": "light"
2021-02-20 00:16:03 +00:00
},
"output_type": "display_data"
2021-02-03 16:08:06 +00:00
}
],
"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()"
]
},
{
2021-02-20 00:16:03 +00:00
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"# Imports & Setup"
2021-02-20 00:16:03 +00:00
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"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",
2021-02-03 16:08:06 +00:00
"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)"
]
},
{
2021-02-20 00:16:03 +00:00
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"## Read Scrobble Frame"
2021-02-20 00:16:03 +00:00
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 4,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
2021-02-03 16:08:06 +00:00
"scrobbles = get_query(cache=cache)"
2021-02-01 21:43:27 +00:00
]
},
{
2021-02-20 00:16:03 +00:00
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"## Write Scrobble Frame"
2021-02-20 00:16:03 +00:00
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-02-20 00:16:03 +00:00
"execution_count": 3,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
2021-02-03 16:08:06 +00:00
"scrobbles.reset_index().to_csv(cache, sep='\\t')"
2021-02-01 21:43:27 +00:00
]
}
2021-02-20 00:16:03 +00:00
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}