2021-02-01 01:37:22 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
2021-05-07 01:03:08 +01:00
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
2021-02-01 01:37:22 +00:00
|
|
|
"source": [
|
|
|
|
"# Stats\n",
|
|
|
|
"\n",
|
|
|
|
"Some easy numbers about habits"
|
2021-05-07 01:03:08 +01:00
|
|
|
]
|
2021-02-01 01:37:22 +00:00
|
|
|
},
|
|
|
|
{
|
2021-05-07 01:03:08 +01:00
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
2021-02-01 01:37:22 +00:00
|
|
|
"source": [
|
|
|
|
"# % of scrobbles with attached URIs"
|
2021-05-07 01:03:08 +01:00
|
|
|
]
|
2021-02-01 01:37:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-05-07 01:03:08 +01:00
|
|
|
"execution_count": 3,
|
2021-02-01 01:37:22 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
2021-05-07 01:03:08 +01:00
|
|
|
"output_type": "stream",
|
2021-02-01 01:37:22 +00:00
|
|
|
"text": [
|
2021-05-07 01:03:08 +01:00
|
|
|
"95.10% joined tracks\n"
|
2021-02-01 01:37:22 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
2021-05-07 01:03:08 +01:00
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAS4AAADnCAYAAACg0LuLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAWe0lEQVR4nO3deZgU5YHH8e87PRwKcmk03qWgAl4I4hqjHGouyytCIHisd9TENYkxSWXXmDGP7lYOV1dNNrrJboyJiYo5TAoPNFGQ6KNBAREPohTeqCgg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1FnjXNXe+ibQnD8WlEVeVNdK3/23Nkw+5rXkyJZo3HV03/4mz6+9aM9Ys3bvetOzoOl9GNLkOkGV5KC6NuBxqplR/T8shB93TdAhg7aF1S5acW5r1xhF1T+7e12zSrB3te9t1gCzLQ3FpxFUzjHmkZd/Rj7TsOxpgtImf/0L9n17+RN387QeYxlGu09WYt1wHyLI8FJdGXDVqifWGf2XjhcMBdjMrXj67NOuF40sPDx7C2v2NycWpOD2x0nWALDPWtrcITzZ4QbQ/yXTPkhHbserN0+vvfeZzpQf778A7BxpTyNMsdqVh9cuuQ2RVHoprIPCu6xzSPQNZt2Z66YHFp5TuM3uY1/c3hoGdvyoXtqJhtQ5zdFPmiwvAC6K3gG1d55Ce6UfThuNKDy86s3R30yjzYp5Ps3iPhtVFKehekYdjXADLUHFlXiN9+89snnjIzOaJ1NHSfFTd4wvOqZ+1Zpx5bkS9adnJdb4KetV1gKzLywHS2HUAqawW6kqzWw4eM73psgkjGn+507TGby+5r3nsg422/gXX2Srg7+VuaIw50RhjjTE
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 432x288 with 1 Axes>"
|
|
|
|
]
|
2021-02-01 01:37:22 +00:00
|
|
|
},
|
2021-05-07 01:03:08 +01:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
2021-02-01 01:37:22 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"no_uri = (\n",
|
|
|
|
" 'SELECT ' \n",
|
|
|
|
" ' COUNT(track) '\n",
|
|
|
|
" 'FROM `sarsooxyz.scrobbles.*` '\n",
|
|
|
|
" 'WHERE '\n",
|
|
|
|
" ' uri IS NOT NULL '\n",
|
|
|
|
")\n",
|
|
|
|
"\n",
|
|
|
|
"uri = (\n",
|
|
|
|
" 'SELECT ' \n",
|
|
|
|
" ' COUNT(track) '\n",
|
|
|
|
" 'FROM `sarsooxyz.scrobbles.*` '\n",
|
|
|
|
")\n",
|
|
|
|
"\n",
|
|
|
|
"no_uri_count = list(client.query(no_uri).result())[0][0]\n",
|
|
|
|
"uri_count = list(client.query(uri).result())[0][0]\n",
|
|
|
|
"\n",
|
|
|
|
"print(f'{( no_uri_count / uri_count ) * 100:.2f}% joined tracks')\n",
|
|
|
|
"plt.pie([no_uri_count, uri_count - no_uri_count], labels=[\"No URI\", \"Attached URI\"])\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-05-07 01:03:08 +01:00
|
|
|
"execution_count": 2,
|
2021-02-01 01:37:22 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from google.cloud import bigquery\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
2021-05-07 01:03:08 +01:00
|
|
|
"from dotenv import load_dotenv\n",
|
|
|
|
"\n",
|
|
|
|
"load_dotenv()\n",
|
2021-02-01 01:37:22 +00:00
|
|
|
"\n",
|
|
|
|
"client = bigquery.Client()"
|
|
|
|
]
|
|
|
|
}
|
2021-05-07 01:03:08 +01: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.9"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 4
|
|
|
|
}
|