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-05-11 00:17:56 +01:00
"execution_count": 9,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
2021-05-10 00:18:57 +01:00
"name": "stdout",
2021-05-11 00:17:56 +01:00
"output_type": "stream",
2021-02-01 21:43:27 +00:00
"text": [
2021-05-11 00:17:56 +01:00
"1,805 scrobbles\n",
"4 days spent listening since Nov. 2017\n",
"4.90 minutes/day\n"
2021-02-01 21:43:27 +00:00
]
},
{
"data": {
2021-05-11 00:17:56 +01: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.219781</td>\n",
" <td>0.572843</td>\n",
" <td>202260.902265</td>\n",
" <td>0.676443</td>\n",
" <td>0.056700</td>\n",
" <td>5.447557</td>\n",
" <td>0.305630</td>\n",
" <td>-8.056303</td>\n",
" <td>0.698451</td>\n",
" <td>0.289536</td>\n",
" <td>110.069952</td>\n",
" <td>3.994636</td>\n",
" <td>0.512103</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>0.216312</td>\n",
" <td>0.160528</td>\n",
" <td>60373.745872</td>\n",
" <td>0.143114</td>\n",
" <td>0.191733</td>\n",
" <td>3.495195</td>\n",
" <td>0.180845</td>\n",
" <td>2.041763</td>\n",
" <td>0.459068</td>\n",
" <td>0.133261</td>\n",
" <td>32.676004</td>\n",
" <td>0.184284</td>\n",
" <td>0.198939</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>0.000512</td>\n",
" <td>0.256000</td>\n",
" <td>48507.000000</td>\n",
" <td>0.173000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.049100</td>\n",
" <td>-16.918000</td>\n",
" <td>0.000000</td>\n",
" <td>0.029600</td>\n",
" <td>52.145000</td>\n",
" <td>3.000000</td>\n",
" <td>0.038300</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>0.049700</td>\n",
" <td>0.451000</td>\n",
" <td>154573.000000</td>\n",
" <td>0.583000</td>\n",
" <td>0.000000</td>\n",
" <td>1.000000</td>\n",
" <td>0.139000</td>\n",
" <td>-9.311000</td>\n",
" <td>0.000000</td>\n",
" <td>0.203000</td>\n",
" <td>87.786000</td>\n",
" <td>4.000000</td>\n",
" <td>0.391000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>0.161000</td>\n",
" <td>0.543000</td>\n",
" <td>199053.000000</td>\n",
" <td>0.666000</td>\n",
" <td>0.000004</td>\n",
" <td>6.000000</td>\n",
" <td>0.303000</td>\n",
" <td>-8.328000</td>\n",
" <td>1.000000</td>\n",
" <td>0.299000</td>\n",
" <td>91.973000</td>\n",
" <td>4.000000</td>\n",
" <td>0.522500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>0.274000</td>\n",
" <td>0.657000</td>\n",
" <td>226520.000000</td>\n",
" <td>0.805000</td>\n",
" <td>0.000648</td>\n",
" <td>8.000000</td>\n",
" <td>0.399000</td>\n",
" <td>-6.442000</td>\n",
" <td>1.000000</td>\n",
" <td>0.380000</td>\n",
" <td>130.990000</td>\n",
" <td>4.000000</td>\n",
" <td>0.638000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>0.946000</td>\n",
" <td>0.948000</td>\n",
" <td>513707.000000</td>\n",
" <td>0.946000</td>\n",
" <td>0.901000</td>\n",
" <td>11.000000</td>\n",
" <td>0.796000</td>\n",
" <td>-2.002000</td>\n",
" <td>1.000000</td>\n",
" <td>0.749000</td>\n",
" <td>188.050000</td>\n",
" <td>5.000000</td>\n",
" <td>0.959000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
2021-02-01 21:43:27 +00:00
"text/plain": [
" acousticness danceability duration_ms energy instrumentalness \\\n",
2021-05-10 00:18:57 +01:00
"mean 0.219781 0.572843 202260.902265 0.676443 0.056700 \n",
"std 0.216312 0.160528 60373.745872 0.143114 0.191733 \n",
"min 0.000512 0.256000 48507.000000 0.173000 0.000000 \n",
"25% 0.049700 0.451000 154573.000000 0.583000 0.000000 \n",
"50% 0.161000 0.543000 199053.000000 0.666000 0.000004 \n",
"75% 0.274000 0.657000 226520.000000 0.805000 0.000648 \n",
"max 0.946000 0.948000 513707.000000 0.946000 0.901000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" key liveness loudness mode speechiness tempo \\\n",
2021-05-10 00:18:57 +01:00
"mean 5.447557 0.305630 -8.056303 0.698451 0.289536 110.069952 \n",
"std 3.495195 0.180845 2.041763 0.459068 0.133261 32.676004 \n",
"min 0.000000 0.049100 -16.918000 0.000000 0.029600 52.145000 \n",
"25% 1.000000 0.139000 -9.311000 0.000000 0.203000 87.786000 \n",
"50% 6.000000 0.303000 -8.328000 1.000000 0.299000 91.973000 \n",
"75% 8.000000 0.399000 -6.442000 1.000000 0.380000 130.990000 \n",
"max 11.000000 0.796000 -2.002000 1.000000 0.749000 188.050000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" time_signature valence \n",
2021-05-10 00:18:57 +01:00
"mean 3.994636 0.512103 \n",
"std 0.184284 0.198939 \n",
"min 3.000000 0.038300 \n",
"25% 4.000000 0.391000 \n",
"50% 4.000000 0.522500 \n",
"75% 4.000000 0.638000 \n",
"max 5.000000 0.959000 "
2021-05-11 00:17:56 +01:00
]
2021-02-01 21:43:27 +00:00
},
2021-05-11 00:17:56 +01:00
"execution_count": 9,
2021-02-01 21:43:27 +00:00
"metadata": {},
2021-05-11 00:17:56 +01:00
"output_type": "execute_result"
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-05-10 00:18:57 +01:00
"artist_name = \"freddie gibbs\".lower()\n",
"\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",
2021-05-10 00:18:57 +01:00
"\n",
2021-02-01 21:43:27 +00:00
"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-05-11 00:17:56 +01:00
"execution_count": 10,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-11 00:17:56 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnEAAAHmCAYAAAAcBtheAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bG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EJ+v2dSJybcy69+Fk5d5nfKVsfLzXFdb2df3zJt7nCvCvfuuX6zK2JUEm2wdwRBjOnN0mIh+OZ9UTkTXud5Wy70dRgobGxClKwDHGHHQF0VeA/SJyL06pjGJgOY414gLOBR5jjBGRtwG/AX4oIv46cbfglF94QcxrNInI3wD/BewRke/huKxux4mBehq4LMEhvx7HuvFlEflz4HEct99S9xiX4CRAxEvi8I/pmIj8PfAx4CnfmG7FufA+lcSYLAdwPkN/nbg1wD3AN+Js/zROcsEuEfk10TpxdTilLWz7q3LgIRE5ipNcchKn1MWtOMH1PzPGHEhgfO8HPioie4Ancb7XWpykg+twhOM73QQIyxtxEgI+JiKvdP8WnDqCt+HMi6bpXtgY0+fOs7uBB0Tkbhz37Vb3OC04Lt14PAzsjZk3l+N8Fv8RZ/tzOJm4+0TkZzhz+VU4Lts7jTEPTjdenBuSdcA/Am9yE3bO43RG2YQTK/c6nIzUVH0/ihIssp0eqw995MuD6UuM3D/N/pfilHQ4iVOOpAPHIvN54Hlxtt+KI9h63cd9OELgo8SUGPHt8zocd9kQjoD4Js5F8aKxM0k5D3ddNU6fz104xYsHcS6m9wBvByqT+NzehONeix3TPqArkTERLa1RCvyzO5ZhnED3jxCn7IT9TtzX+iaO6BxyP5/Xx2x
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
2021-05-11 00:17:56 +01:00
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
"# resample by day and mean\n",
2021-05-10 00:18:57 +01:00
"artist_frame.resample(\"1M\").count()[\"track\"].plot()\n",
2021-02-01 21:43:27 +00:00
"\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-05-11 00:17:56 +01:00
"execution_count": 11,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-11 00:17:56 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAG5CAYAAAAzjmgkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAABJ0AAASdAHeZh94AABP9ElEQVR4nO3deZwUxf3/8ddnOXbB5VJuEbk8EEEjCh6gCCIShHhg8CKiUTD+iJDDeKCwYIxgDCpGVOKBIoYgGm9OEc+IfjUEUTxAECMoKAJiVpDd+v1RPWszO7M7M3s1y/v5eMxjdquruqtreno+U1XdY845RERERCS6sqq6AiIiIiJSMgVsIiIiIhGngE1EREQk4hSwiYiIiEScAjYRERGRiFPAJiIiIhJxCthEREREIk4Bm4iIiEjEKWATERERiTgFbCIiIiIRp4BNREREJOIUsElkmdmVZva+meWbmTOz0VVQh7xg273SKLPEzFxcWq9gPXnlXMWMJatTovqnsC5nZkvKs34ilUXHr+wJFLBJJJnZucAdwPfA7cB44I2qrJNEm5l9FHzwvl7VdakuzGxY0Kbhx3Yz+6+ZLTKzCWZ2UFXXMyoy+bIjkqqaVV0BkSROjz0759ZXaU3Kx5tAR+Crqq5ISBTrlBEzOxk4CHDAcWZ2uHNuRRVXqzr5D/Bk8HcdoCnQHbgBGGNmdwK/d87tqprqlVlH4H9VXQmRkihgk6hqCVBNgjWcc/8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JsHFFQnytSf51YSPplmnJZR+legvErwmDn/rg0RXif4AtA/SsoETEuxDLfyH2m4XCyTZ3+ODfO+VkCcLf0sFBxwUSj8gaPPX8LeDSDh5Pd1jqbTjNlj+Ab7XrGXcazQ
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-04 13:34:25 +00:00
},
"metadata": {
"needs_background": "light"
2021-05-11 00:17:56 +01:00
},
"output_type": "display_data"
2021-02-04 13:34:25 +00:00
}
],
"source": [
"x = np.arange(len(float_headers))\n",
"width = 0.35\n",
2021-05-10 00:18:57 +01:00
"\n",
"plt.bar(x - width/2, \n",
2021-05-11 00:17:56 +01:00
" artist_frame.drop_duplicates(['uri'])[float_headers].mean(), \n",
2021-05-10 00:18:57 +01:00
" width, label='All Listened Tracks')\n",
"plt.bar(x + width/2, \n",
2021-05-11 00:17:56 +01:00
" artist_frame[float_headers].mean(), \n",
2021-05-10 00:18:57 +01:00
" width, label='Distinct Tracks', color=(1, 0, 0))\n",
2021-02-04 13:34:25 +00:00
"\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-05-11 00:17:56 +01:00
"execution_count": 12,
2021-02-04 13:34:25 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-11 00:17:56 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAHmCAYAAADOVtIGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOydZ3gUVduA77Ob3hNaQu+9d+lNRUU6ih39LNixYXtfBXt77YoNFWwIiEqz0HuH0EIPAUIIIb233fP9mE3I7swmmx7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TOczeki5bnunJ6PARFowtQtNhPsn2jXz04pZW4p5nFGX9vrP44CrAGLgTeAz4QQ1wL/oJntImwPNZWOlHKzEOIo2gNjcBGB9Ta0e9L3BX2FFlDTBc2xf5pmXdaRg/Fn5OzeWFUclQ7uAbZ76XnAV0oZaTDmLJpLAlDu81dUMkpgU5SWWCftBc7Dz5Qw3s/2Gmh7debjYbSOK2NcEdgK9nq17c8ZfsUcc3VP5ym9wKabS0qZL4SIRxN8S+xvo+A9DCzS9gQQieaf8pztL18IsRx4Skp5vIS9nbO91hJCeJVRy5Zs0FaglTA7tP+K5sMWiSZ4xKL9YABMA5w5QBtep0KIIDSfqmZoQtBcNHNRPhf9uYrOGWR7tdMal5HyXHfOvnc6bD/Sw4CX0Hy5CrRgaUKIOWhmzHRX5zMgyPZa4ntie2jpjWZKGwmMtx06I4R4T7qWgqPg3Bu50Legj2OU+xw0c+lkNNM2aBq3PDQtVAHBaO4MdbiYYsNVXP6MKglnD135JRwrKgeU5/wVlYwyiSpKi7On4oIbQqCUUhTzt86hfz0n84UWs0Z
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
2021-05-11 00:17:56 +01:00
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
"# select only descriptor float columns\n",
2021-05-11 00:17:56 +01:00
"artist_frame[float_headers].resample(\"1M\").mean().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-05-11 00:17:56 +01:00
"execution_count": 13,
2021-02-03 16:08:06 +00:00
"metadata": {},
"outputs": [],
"source": [
2021-05-11 00:17:56 +01:00
"LIMIT = 40\n",
2021-05-10 00:18:57 +01:00
"fig_size = (7,(7/20)*LIMIT)\n",
"### STATS ###\n",
2021-02-03 16:08:06 +00:00
"\n",
2021-05-10 00:18:57 +01:00
"stats_frame = scrobbles.reset_index()[[\"track\", \"album\", \"artist\", \"duration_ms\"]]\n",
"stats_frame = stats_frame[stats_frame[\"album\"] != \"Mirror Reaper\"] # 1:30 hr long song, skews graphs\n",
2021-02-03 16:08:06 +00:00
"\n",
2021-05-10 00:18:57 +01:00
"track_count = stats_frame.groupby('artist').count()[\"track\"]\n",
"track_count.name = 'count'\n",
2021-02-03 16:08:06 +00:00
"\n",
2021-05-10 00:18:57 +01:00
"duration_sum = stats_frame.groupby('artist').sum()[\"duration_ms\"]\n",
"duration_sum.name = \"duration_sum\"\n",
"\n",
"duration_average = stats_frame.groupby('artist').mean()[\"duration_ms\"]\n",
"duration_average.name = \"duration_mean\"\n",
"\n",
"track_average = stats_frame.groupby(['artist', 'track'])[\"album\"].count()\n",
"track_average = track_average.groupby('artist').mean()\n",
"track_average.name = \"track_average\"\n",
"\n",
"stats_frame = pd.concat([track_count, duration_sum, duration_average, track_average], axis=1).reset_index()\n",
"# stats_frame"
2021-02-03 16:08:06 +00:00
]
},
{
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-05-11 00:17:56 +01:00
"execution_count": 14,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-11 00:17:56 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA6gAAAVbCAYAAAAsl4elAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaH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imV65Ds7HRs8e8+G6d5Hz/ce7pWYsRaqePw8fp45F9rlnoOZdJ7sMkRrXa6di3cneCN9Hr7qiqw2gSN2iemTnVrmuPD5lA3c5nsto4n2O/UedxtdOnP0jzrNhPjhPDuqOcf1BPvY7DaaYQvzLJ8knWBnYA/lRVf1qUeBfRRDZH6uh8X+ZPYzzS0DNBlSRpeP0WeEA7CjM0quqWqjqtqj7M3etkd+6q0vkP8eVZ2Ok06wOfOY0h/pUmEXtqu5vvRPyhPW7V59wz6H8vYzkbeNAiPjLkP+2x79zkxfTb9rjDJOpO5+/qUOCPNLtcb957sqr+Q/Ps1Ick2ajP9Z1/yPhDd2G7Hvcwmp2Nn02zpvk+LNnR05VoZhrcQbMx13g2bo9nTVdM0tLABFWSpOHVGUk7sN8zJ9tnXz61t3w6JHl6kpX7nOqMON7UVdaZbrzQZi/txjbfBTZP8qGeTaE6fW2Q5JG95RPVri/8Es3o2hf7xZ3kQUke21U0pz1+oPv5mG2S8alFCONEmv/OekrviSQvT7LtKM9iXRfYo3178iL0O56v0kz9/VDP/Xf6f2jX2y/TrIHeP8lCj8RJct922vcia9fYvosmGR/tcz6oPf/Z7u9LkjWBD3XV6TWnPe7evm6n+e4tKS+mmW1w1DibI3V0/pbnjllLWsa5BlWSpCFVVccneR/Nf7j/PckvaXYCXgV4BM1o36nAcybR7DO
"text/plain": [
"<Figure size 840x1680 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
2021-05-11 00:17:56 +01:00
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-05-10 00:18:57 +01:00
"duration_frame = stats_frame.sort_values(by='duration_sum', ascending=False).head(LIMIT)\n",
"\n",
2021-02-03 16:08:06 +00:00
"plt.figure(figsize=fig_size)\n",
2021-05-10 00:18:57 +01:00
"plt.barh(np.arange(len(duration_frame))[::-1], duration_frame[\"duration_sum\"].to_numpy() / (1000 * 60 * 60) )\n",
"plt.yticks(np.arange(len(duration_frame))[::-1], labels=duration_frame[\"artist\"])\n",
2021-02-01 21:43:27 +00:00
"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-05-11 00:17:56 +01:00
"execution_count": 15,
2021-02-03 16:08:06 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-11 00:17:56 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1UAAAVbCAYAAADJJYCMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAABJ0AAASdAHeZh94AAEAAElEQVR4nOzdd7hcVb3/8fcHREAggDTrFSmKYkF/aFSqqCBy7V0UsWDBhv3iVcFyFa+9XBRRCVjBgiJKUUggiIqgKIKilCigGFAg0tv398faA5PJnJOTzDk5gbxfzzPPnFl77bW/e058PF/WWt+dqkKSJEmStHRWmu4AJEmSJOmOzKRKkiRJkkZgUiVJkiRJIzCpkiRJkqQRmFRJkiRJ0ghMqiRJkiRpBCZVkiRJkjQCkypJkiRJGoFJlSRJkiSNwKRKkiRJkkZgUiVJkiRJIzCpkiTpDizJxkkqyazpjkXLjr93afliUiVJWmpJ/rv7w66SPHC647mz6PtOe69bklye5MQkL5ru+CZLkv2H3Ot1Sf6U5P+S3GcZx7PxkHgW99pxWcYoafl0l+kOQJJ0x5QkwCuBAgLsBbxtWoO683lf974KsAXwdODxSbauqrdMX1iT7iRgTvfz+sDOwN7A85I8pqrOX0ZxXMnt33m//br3YcfmTVUwku44UlXTHYMk6Q4oyS7AscAs4Mm0/1B376q6cTrjujNIUgBVlYH2JwA/6T5uUlXzkmwMXAgcWlV7Lss4R5Vkf1rC8r6q2r+vfRXgGOAJwKyqetm0BHh7PEN/H9Ppjvx7l+6MXP4nSVpae3XvBw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zLCqd6Ooqq8k+X+0ZzW
"text/plain": [
"<Figure size 840x1680 with 1 Axes>"
]
2021-02-03 16:08:06 +00:00
},
"metadata": {
"needs_background": "light"
2021-05-11 00:17:56 +01:00
},
"output_type": "display_data"
2021-02-03 16:08:06 +00:00
}
],
"source": [
2021-05-10 00:18:57 +01:00
"norm_frame = stats_frame.sort_values(by='count', ascending=False).head(LIMIT) # for top artists\n",
"# norm_frame = stats_frame.sort_values(by='track_average', ascending=False).head(LIMIT) # for one-hit wonders\n",
"\n",
2021-02-03 16:08:06 +00:00
"plt.figure(figsize=fig_size)\n",
2021-05-10 00:18:57 +01:00
"plt.barh(np.arange(len(norm_frame))[::-1], norm_frame[\"track_average\"] )\n",
"plt.yticks(np.arange(len(norm_frame))[::-1], labels=norm_frame[\"artist\"])\n",
2021-02-03 16:08:06 +00:00
"plt.xlabel(\"Average plays per song\")\n",
"plt.grid(axis=\"x\")\n",
2021-05-10 00:18:57 +01:00
"plt.title(\"Average Plays Per Track\")\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-05-11 00:17:56 +01: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-05-11 00:17:56 +01:00
"execution_count": 2,
2021-02-01 21:43:27 +00:00
"metadata": {},
2021-05-10 00:18:57 +01:00
"outputs": [],
2021-02-01 21:43:27 +00:00
"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": {
2021-05-11 00:17:56 +01:00
"display_name": "Python 3",
"language": "python",
"name": "python3"
2021-02-20 00:16:03 +00:00
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2021-05-07 01:03:08 +01:00
"version": "3.8.9"
2021-05-10 00:18:57 +01:00
},
"metadata": {
"interpreter": {
"hash": "bce1a3677099e73bf385a0de8ef462673e03f7df0abce93e57e7ca76e8c504a2"
}
2021-02-20 00:16:03 +00:00
}
},
"nbformat": 4,
"nbformat_minor": 4
2021-05-11 00:17:56 +01:00
}