listening-analysis/artist.ipynb

529 lines
376 KiB
Plaintext
Raw Normal View History

2021-02-01 21:43:27 +00:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"# Artist Investigations"
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-05-07 01:03:08 +01:00
"execution_count": 4,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
2021-02-01 21:43:27 +00:00
"text": [
2021-05-07 01:03:08 +01:00
"1,233 scrobbles\n",
"4 days spent listening since Nov. 2017\n",
"4.46 minutes/day\n"
2021-02-01 21:43:27 +00:00
]
},
{
"data": {
"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",
2021-05-07 01:03:08 +01:00
" <td>0.046042</td>\n",
" <td>0.714379</td>\n",
" <td>270745.820490</td>\n",
" <td>0.800026</td>\n",
" <td>0.346944</td>\n",
" <td>5.617338</td>\n",
" <td>0.134218</td>\n",
" <td>-7.078945</td>\n",
" <td>0.441331</td>\n",
" <td>0.054055</td>\n",
" <td>122.854020</td>\n",
" <td>3.995622</td>\n",
" <td>0.498696</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
2021-05-07 01:03:08 +01:00
" <td>0.084004</td>\n",
" <td>0.076841</td>\n",
" <td>77567.562426</td>\n",
" <td>0.096553</td>\n",
" <td>0.379047</td>\n",
" <td>3.463314</td>\n",
" <td>0.133318</td>\n",
" <td>1.108589</td>\n",
" <td>0.496764</td>\n",
" <td>0.022931</td>\n",
" <td>4.799479</td>\n",
" <td>0.066053</td>\n",
" <td>0.190035</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
2021-05-07 01:03:08 +01:00
" <td>0.000098</td>\n",
" <td>0.345000</td>\n",
" <td>179080.000000</td>\n",
" <td>0.257000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.030300</td>\n",
" <td>-12.378000</td>\n",
" <td>0.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.027700</td>\n",
" <td>69.942000</td>\n",
" <td>3.000000</td>\n",
" <td>0.039900</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
2021-05-07 01:03:08 +01:00
" <td>0.005240</td>\n",
" <td>0.671000</td>\n",
" <td>216841.000000</td>\n",
" <td>0.744000</td>\n",
" <td>0.000643</td>\n",
" <td>3.000000</td>\n",
" <td>0.067600</td>\n",
" <td>-7.636000</td>\n",
" <td>0.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.041100</td>\n",
" <td>121.982000</td>\n",
" <td>4.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.327000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
2021-05-07 01:03:08 +01:00
" <td>0.013200</td>\n",
" <td>0.712000</td>\n",
" <td>235200.000000</td>\n",
" <td>0.798000</td>\n",
" <td>0.122000</td>\n",
" <td>6.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.088000</td>\n",
" <td>-6.865000</td>\n",
" <td>0.000000</td>\n",
" <td>0.048600</td>\n",
" <td>123.951000</td>\n",
" <td>4.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.520000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
2021-05-07 01:03:08 +01:00
" <td>0.043800</td>\n",
" <td>0.781000</td>\n",
" <td>291779.000000</td>\n",
" <td>0.880000</td>\n",
" <td>0.862000</td>\n",
" <td>9.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.117000</td>\n",
" <td>-6.246000</td>\n",
" <td>1.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.060800</td>\n",
" <td>124.998000</td>\n",
" <td>4.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.668000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
2021-05-07 01:03:08 +01:00
" <td>0.735000</td>\n",
" <td>0.843000</td>\n",
" <td>472444.000000</td>\n",
" <td>0.976000</td>\n",
" <td>0.919000</td>\n",
" <td>11.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.676000</td>\n",
" <td>-4.063000</td>\n",
" <td>1.000000</td>\n",
2021-05-07 01:03:08 +01:00
" <td>0.151000</td>\n",
" <td>176.994000</td>\n",
" <td>4.000000</td>\n",
" <td>0.853000</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-07 01:03:08 +01:00
"mean 0.046042 0.714379 270745.820490 0.800026 0.346944 \n",
"std 0.084004 0.076841 77567.562426 0.096553 0.379047 \n",
"min 0.000098 0.345000 179080.000000 0.257000 0.000000 \n",
"25% 0.005240 0.671000 216841.000000 0.744000 0.000643 \n",
"50% 0.013200 0.712000 235200.000000 0.798000 0.122000 \n",
"75% 0.043800 0.781000 291779.000000 0.880000 0.862000 \n",
"max 0.735000 0.843000 472444.000000 0.976000 0.919000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" key liveness loudness mode speechiness tempo \\\n",
2021-05-07 01:03:08 +01:00
"mean 5.617338 0.134218 -7.078945 0.441331 0.054055 122.854020 \n",
"std 3.463314 0.133318 1.108589 0.496764 0.022931 4.799479 \n",
"min 0.000000 0.030300 -12.378000 0.000000 0.027700 69.942000 \n",
"25% 3.000000 0.067600 -7.636000 0.000000 0.041100 121.982000 \n",
"50% 6.000000 0.088000 -6.865000 0.000000 0.048600 123.951000 \n",
"75% 9.000000 0.117000 -6.246000 1.000000 0.060800 124.998000 \n",
"max 11.000000 0.676000 -4.063000 1.000000 0.151000 176.994000 \n",
2021-02-01 21:43:27 +00:00
"\n",
" time_signature valence \n",
2021-05-07 01:03:08 +01:00
"mean 3.995622 0.498696 \n",
"std 0.066053 0.190035 \n",
"min 3.000000 0.039900 \n",
"25% 4.000000 0.327000 \n",
"50% 4.000000 0.520000 \n",
"75% 4.000000 0.668000 \n",
"max 4.000000 0.853000 "
]
2021-02-01 21:43:27 +00:00
},
2021-05-07 01:03:08 +01:00
"execution_count": 4,
2021-02-01 21:43:27 +00:00
"metadata": {},
"output_type": "execute_result"
2021-02-01 21:43:27 +00:00
}
],
"source": [
2021-05-07 01:03:08 +01:00
"artist_name = \"gorgon city\".lower()\n",
"artist_frame = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name] # FILTER SCROBBLES\n",
2021-02-01 21:43:27 +00:00
"artist_frame = artist_frame.sort_index(ascending=False) # SORT\n",
"# artist_frame = artist_frame.loc[:, descriptor_headers] # DESCRIPTORS\n",
"\n",
"total_time = artist_frame[\"duration_ms\"].sum() / (1000 * 60) # minutes\n",
"total_days = total_time / (60 * 24) # days\n",
"print(f'{artist_frame.count()[0]:,d} scrobbles')\n",
"print(f'{total_days:.0f} days spent listening since Nov. 2017')\n",
"print(f'{total_time / days_since(first_day).days:.2f} minutes/day')\n",
"\n",
"artist_frame.describe()[1:]"
]
},
{
"cell_type": "code",
2021-05-07 01:03:08 +01:00
"execution_count": 5,
2021-02-01 21:43:27 +00:00
"metadata": {},
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bGt2H7wghBghojdA88vaSUQ/A7AbQBc0D6vVANYXeApA8wnLAvg7IrocmqAfQoi/tW33HWg2ESuh+WR9z+PuvhHAJ4joALRM3yCAOIDLADwXWrD3PiHEOeUx7wZwOYB3QPMN+wU0+4r10KxFXgatE7IgQghBRL8D4JfQvOV+AC0zdQk0H7dpaN2l9s8W0BorHiKib+v7fLP+cwKaNs6J/dDWj+pjthGat9pXi+0vgL+B5t32DgAvJaJfQdPaLYGmPbsJwAehebEBwP8BmCGiR/X9ImjB5nXQOjbvcfGaDFN/VLstlH/4J+w/0DLTfwLtpLkALRD6T2jZiWlonYz2x7QC+AA0v62Evt2DAF7vsO06aBqkL9XqPkC3XPD4vl0GLdt3Flrgch5aZ+DbbNvl2GXot78JWpehYWWR53Wkf9c/+vhsr4Ym8P8VNIuMBLRS4FFoXYU353lcHFoQshta5mcaWkDyb1B8u2DaZawrsA+XQAuMBqEFTIMAvgbgEodtP6I/3+3QOlDl+3MBWtZreb7PDppW7m/1v3MBmonwh+Fs0ZLvMyFoJrL3AhjTP9ez+rr6AIDVyrbvgBacHdPfozFoJdM/A9BZ7e81//BPuX5IiHx6YYZhyomu3zoE4H+FEK9v1H2oNqSNN7oVWiBzuMq7wzBMg8MaM4YpM0S0zEFL1A4tOwJoWYHQ70MtQkTboYnaf8FBGcMwtQBrzBim/LwHwOv1zMwgNEuCOwCsgqb1+U6D7EPNQNog9JXQZi5mUdhbi2EYpmJwYMYw5eeX0ETPL4DW5p+GVj78JDQz00roCWphH2qJP4cWlB6DNmrIyVmfYRim4rDGjGEYhmEYpkZgjRnDMAzDMEyNwIEZwzAMwzBMjcCBGcMwDMMwTI1
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
2021-02-01 21:43:27 +00:00
"# resample by day and mean\n",
"filtered_artist = filtered_artist.resample(\"2W\").count()\n",
2021-02-01 21:43:27 +00:00
"\n",
"filtered_artist[\"energy\"].plot()\n",
"\n",
"plt.title(f\"{artist_name} Scrobbles\")\n",
"plt.grid()\n",
"plt.show()"
]
},
2021-02-04 13:34:25 +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-04 13:34:25 +00:00
},
2021-02-01 21:43:27 +00:00
{
"cell_type": "code",
2021-05-07 01:03:08 +01:00
"execution_count": 6,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-07 01:03:08 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAG5CAYAAAAzjmgkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAABJ0AAASdAHeZh94AABPY0lEQVR4nO3deXhU1f3H8fc3LAEMm4KAIAZBFBGkoqAWFEGllKUuWFwrWgXrjyq1tS5QDFgrWkoVKip1wQWLiBZXNkVcK9paiigugBEVFJQ1iiBwfn+cO3EymUlmJsnkJvm8nmeeSc49555zz9w7851zz71jzjlEREREJLyyKrsBIiIiIlIyBWwiIiIiIaeATURERCTkFLCJiIiIhJwCNhEREZGQU8AmIiIiEnIK2ERERERCTgGbiIiISMgpYBMREREJOQVsIiIiIiGngE1EREQk5BSwiUhcZubMbEllt0OkLMws38zyK7sdImWlgE1EkmZmeUEg1yfD9S4K6v3UzGplsu7qysz6BH0a/fj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yETuU6LS6gfb+Cn+NiRxJ6/jRz83AxuAHnGWZxFzYQUlTDoPlkeuaO0akx65mMQBw6PSG+FHk1K5SvSw4PX7EOgYpw11gd5J9nOfeK9x1PIj8bcWccCzZek/oDPQIk6+o4P1L41KK+0q0dZxtiGvhO3MJ72rRBfHpN8apJ8Upw7DXwXqgKExy4byw/tEvKtE+yRqux56RD80h02qJOfcS2Y2HT+5/V0zexx/6msw/gN7HX7uULRJ+NGlnwH/M7Pn8PdAOwt/muZW51y8CwhC24ZUOOe+MrNz8VdZvmhm84Dl+MChKz5QalfKal7Eb9PNZnYE/kMb59wfY/I9hr9
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-04 13:34:25 +00:00
},
"metadata": {
"needs_background": "light"
},
"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-05-07 01:03:08 +01:00
"execution_count": 7,
2021-02-04 13:34:25 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-07 01:03:08 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAHmCAYAAADOVtIGAAAAOXRFWHRTb2Z0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KIVE3TvgLu0jRtsJC+daORN+vpQogsH4ZJRApJfkjBpjgRikkGc3NI2SyfMAbSgftB5PH/E3l8Mt3LJiF9oYwwvC7cAuoKpB/jHmSwylku+DM+hzRz5hDh/i6N81Ld/d3d/fFGiEGbt+vcG9cjffVu5EL6iCxN074HHhVC6H4XRSDC/V3oMXELj73ccxiNdBUAOKdp2gzgZSEjUQsiZ98b+DC3nHU8heu5SB/E25DHBfffIP0N81Id+dx7rpBthSA1dDmcEUKqoCoIb9GjDgAhhNHyHEHVmqetuPuvqAQogU1RVHKcUWvh4VCsaZoZeUPIe7PPuZHU9jJeHY/18uLtBlmecygNktzf9ZARqmXFTKQT/3+Q5pCcYINPfOnsFqw2AgOQ+b/KLKWEpmlRyEjHPUjfwVSP5TcUNFUv7WOQwtpcIcRkj/HqoH9IJbm/61Fycq6dd4UQDxexb5EEASFEJtI8+7ymaQ2Q52sScDPSzNm/iNvPS5L726djIoSIAe5wa0svA4YgzfPPIl9onilkiBwt+SBN08yFaOaGub/XebT/iLwn3Kxp2lPI3/8VSA39To91k5F+eZGFzMuTihTWSpPi7r+iEqAqHSiKynb3dz+DZb3weAlwP4iPAPU0TWth0Gew+3vbRTaHorDR/V2S6gA5DzJPLVUuQohdyIfZtZqm9UQ+4NYIIfYXYTs5wt2j7ihAr7jzsRWXpsj7z1IDYa2+e3lRae7+XmSwbKBB2wGkgNJB07S6Poxf0DnYhPSRLIm
"text/plain": [
"<Figure size 720x480 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
"filtered_artist = scrobbles[scrobbles[\"artist\"].str.lower() == artist_name]\n",
2021-02-01 21:43:27 +00:00
"# select only descriptor float columns\n",
"filtered_artist = filtered_artist.loc[:, float_headers]\n",
"# resample by day and mean\n",
"filtered_artist = filtered_artist.resample(\"1M\").mean()\n",
"\n",
"# filtered_playlist[\"energy\"].plot()\n",
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()"
]
},
{
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"# Artist Listening Time"
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-05-07 01:03:08 +01:00
"execution_count": 8,
"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)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For these charts the ordering is left as retrieved from the API, i.e by most played."
]
},
{
"cell_type": "code",
2021-05-07 01:03:08 +01:00
"execution_count": 9,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-07 01:03:08 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1UAAAOACAYAAADSDFlaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAABJ0AAASdAHeZh94AADplUlEQVR4nOzdd5xcVf3/8debjkASOoJKICBVRH9A6E1pIkUBCzWogCAiIIIoJSBfQEEBxUgnhA7SeygJC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zPQYsnv9r9ywjIiZFxCMRcQLT1n3tUqhS+eNxXmb0BGm9y2ZdGOJ/ScnDhnkXwHr8Ox+3qHJuU6rfS2ueBb7Ywe2xP8rHqvMWG1R54O4O7ajblb+ry4GnSLtjrlc+GREfkZ5ttYKkVatcX0m+/10szOvLriPtiPht0hq9+Zi5o1QLkUZ0J5M2R2nL6vn4dFfFZDY7cFJlZmadrTJicWG1ZwLlZxNtWC7vCpI2lrRwlVOVkZ1PCmWVqYgzLLjPmwtcCawn6fjSxhyVvnpJWqlcXq+8XuZvpFGMv1aLW9IXJa1ZKOqfj78vPr8o/2F8WgfCGEz622CD8glJP5a0TY1nZS0HHJDfDulAv235B2la4PGl+6/0/6XC23NJa/rOkjTD9u+SFshTQjssrxk7ipRA1vqcL8nnzyh+XyQtBRxfqFPWPx/3za/PSd+9mWUP0qjuXW1sUFFR+bc8qNVaZnM4r6kyM7NOFRH3S/ot6Y/NVyTdSdpBcFFgRdKoykPA9u1odlNJ/Wuc+3dE/LXGuaOBrSVVdjEcD6xFGvEYQ3qWUcUg0mjUaZLWzueJiFPy+UNJ651OBvaR9BBpLdPypM0j1ieNXLzRjvs
"text/plain": [
"<Figure size 840x1050 with 1 Axes>"
]
2021-02-01 21:43:27 +00:00
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
2021-02-01 21:43:27 +00:00
}
],
"source": [
"plt.figure(figsize=fig_size)\n",
2021-02-01 21:43:27 +00:00
"plt.barh(np.arange(len(artists))[::-1], np.array(artists_time) / (1000 * 60 * 60) )\n",
"plt.yticks(np.arange(len(artists))[::-1], labels=[i.name for i in artists])\n",
"plt.xlabel(\"Time (Hours)\")\n",
"plt.grid(axis=\"x\")\n",
"plt.title(\"Time Listened (Since Nov 17)\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
2021-05-07 01:03:08 +01:00
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
2021-05-07 01:03:08 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1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h1/JM3anVPtHEmfKM0CDcnvv5a0bKHf4qRKeF1C0hZ5JqxsjnvKKsvGPlPuHBGjSWXUvyXpB+Xj+Vqfk7RiI/F2oqGkv9VTVdj0JunTwKHtHKvm99KNzszv50v6ZPmgpCXz0lgza5D3VJmZWZsi4u38HKrf1Tj+oKTfAUcBT+Z9WO+SZjTWJ23yP7274q3iLFLydL+kq0nLojYmzT78nbQXqqOOAraWVKnONpW0TG4HYBIfVayDtCxwQ+DHwDcl3UsqKrAiaa/VpqTE9WmAiHhA0h9JM4SV77XynKpJ1N7D1qhzSDM2D5AS0veB/wdsTaqmV6zkdw+pAMj5kq4F3iEVWvhTPr4naT/bhZJ+RlpuOZk0e7kB6e9jE9Lzk5rtd6Tnbn0XWEvSMNK+tm8DI/OxWXWO9Szpd/tdSR+QvrcALu2u5XYRcY+kX5IS8Ocl3Ub6G+1Fen7XlqT/bW7fHfGYzc+cVJmZWb3OIT10tG+1gxFxtKTHSA8N3oe0Yf5F0n6m38fcD/7tNhFxh6Rv5li+Q1qa9QjpOT6r01hSNZiU4PQnJWkfA17L7b8v/gM6Ij6QtAvwfdJzgr5B+gfuBNI/do8jVd4r+jnwHPATUsGIt4DrgV8B/24g7tacAuxKSjy/RkokXsntZ0XEpMI93SnpCGB/0mzOoqQE4k/5+GuS/h8pMdyNVMJ7YVJp+adJs3dPdNF9tEtETJO0FWlmdnfgMNLv5RTSjNsufLT3qq2xZkraFTiN9HDepQCRkphu28MUEb/NyfHPSH+fO5P+o8LrpIT/8u6KxWx+ptaLLpmZmZm
"text/plain": [
"<Figure size 840x1050 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"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()"
]
},
{
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"# Imports & Setup"
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
"execution_count": 1,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime\n",
"\n",
"from google.cloud import bigquery\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"mpl.rcParams['figure.dpi'] = 120\n",
"\n",
"from analysis.net import get_spotnet, get_fmnet, get_playlist, track_frame\n",
"from analysis.query import *\n",
"from analysis import float_headers, days_since\n",
2021-02-01 21:43:27 +00:00
"\n",
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"client = bigquery.Client()\n",
"spotnet = get_spotnet()\n",
"fmnet = get_fmnet()\n",
"cache = 'query.csv'\n",
"first_day = datetime(year=2017, month=11, day=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"## Read Scrobble Frame"
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
2021-05-07 01:03:08 +01:00
"execution_count": 2,
2021-02-01 21:43:27 +00:00
"metadata": {},
2021-05-07 01:03:08 +01:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"query.csv not found, pulling\n"
]
}
],
2021-02-01 21:43:27 +00:00
"source": [
"scrobbles = get_query(cache=cache)"
2021-02-01 21:43:27 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
2021-02-01 21:43:27 +00:00
"source": [
"## Write Scrobble Frame"
]
2021-02-01 21:43:27 +00:00
},
{
"cell_type": "code",
"execution_count": 3,
2021-02-01 21:43:27 +00:00
"metadata": {},
"outputs": [],
"source": [
"scrobbles.reset_index().to_csv(cache, sep='\\t')"
2021-02-01 21:43:27 +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",
2021-05-07 01:03:08 +01:00
"version": "3.8.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}