2024-05-02 03:05:34 +00:00
{
"cells": [
{
"cell_type": "code",
2024-05-04 10:52:52 +00:00
"execution_count": 22,
2024-05-02 03:05:34 +00:00
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from datetime import datetime, timezone, timedelta\n",
"import pytz\n",
2024-05-04 10:52:52 +00:00
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import sqlite3\n",
"\n",
"db = sqlite3.connect(\"./scores.db\")\n",
2024-05-02 03:05:34 +00:00
"\n",
"with open(\"data/output.csv\", \"rb\") as f:\n",
" data = pd.read_csv(f, delimiter=\"\\t\")"
]
},
{
"cell_type": "code",
2024-05-04 10:52:52 +00:00
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[datetime.datetime(2024, 1, 1, 0, 0), datetime.datetime(2024, 1, 15, 0, 0), datetime.datetime(2024, 1, 17, 0, 0), datetime.datetime(2024, 1, 18, 0, 0), datetime.datetime(2024, 1, 20, 0, 0), datetime.datetime(2024, 1, 27, 0, 0), datetime.datetime(2024, 1, 29, 0, 0), datetime.datetime(2024, 2, 1, 0, 0), datetime.datetime(2024, 2, 3, 0, 0), datetime.datetime(2024, 2, 4, 0, 0), datetime.datetime(2024, 2, 20, 0, 0), datetime.datetime(2024, 3, 4, 0, 0), datetime.datetime(2024, 3, 5, 0, 0), datetime.datetime(2024, 3, 10, 0, 0), datetime.datetime(2024, 3, 12, 0, 0), datetime.datetime(2024, 3, 14, 0, 0), datetime.datetime(2024, 3, 23, 0, 0), datetime.datetime(2024, 3, 27, 0, 0), datetime.datetime(2024, 3, 28, 0, 0), datetime.datetime(2024, 4, 3, 0, 0), datetime.datetime(2024, 4, 5, 0, 0), datetime.datetime(2024, 4, 9, 0, 0), datetime.datetime(2024, 4, 11, 0, 0), datetime.datetime(2024, 4, 13, 0, 0), datetime.datetime(2024, 4, 14, 0, 0), datetime.datetime(2024, 4, 17, 0, 0), datetime.datetime(2024, 4, 18, 0, 0), datetime.datetime(2024, 4, 20, 0, 0), datetime.datetime(2024, 4, 24, 0, 0), datetime.datetime(2024, 4, 25, 0, 0), datetime.datetime(2024, 5, 1, 0, 0), datetime.datetime(2024, 5, 3, 0, 0)]\n"
]
},
{
"data": {
"image/png": "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
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from datetime import date, datetime\n",
"c = db.cursor()\n",
"result = c.execute(\"\"\"\n",
" SELECT COUNT(*), UNIXEPOCH(DATE(scores.\"Time Played\")) as date FROM scores\n",
" GROUP BY date\n",
"\"\"\")\n",
"result = list(result)\n",
"result.sort(key=lambda x: x[1])\n",
"y, x = list(zip(*result))\n",
"dates = list(map(lambda x: datetime.utcfromtimestamp(x), x))\n",
"# dates = matplotlib.dates.date2num(x)\n",
"print(dates)\n",
"plt.title(\"Amount of maps played per session over time\")\n",
"plt.xticks(rotation=45, ha=\"right\")\n",
"plt.plot(dates, y)\n",
"plt.gcf().autofmt_xdate()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHoCAYAAAClyIAVAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAADNZklEQVR4nOzdd3wUdf7H8ddsL0k2hZAQCBCaFBEURcGCICeeWFCsWMCGeqKih3r2s5z+7HKict4peogFzzs8sSAW8AREBBEpgkDoSSAk2U227878/tjsJksSSGWT8Hk+HvuY2ZnZme8uIfvO9/ud71fRNE1DCCGEEOIIpEt0AYQQQgghEkWCkBBCCCGOWBKEhBBCCHHEkiAkhBBCiCOWBCEhhBBCHLEkCAkhhBDiiCVBSAghhBBHLAlCQgghhDhiSRASQgghxBFLgpAQQtQiFApx9913k5ubi06nY9y4cYkuUrN78803URSFH3/8sVGv//Of/4yiKM1cqsZpTWURbYsEISEa4ZVXXkFRFE488cREF0W0kDfeeINnnnmGiy66iLfeeos77rgj0UUSQrQAQ6ILIERbNGfOHLp3784PP/zA5s2b6dWrV6KLJJrZ119/TefOnXnhhRcSXRQhRAuSGiEhGig/P5+lS5fy/PPPk5mZyZw5cw57GVRVxefzHfbrtgXN9dns3buX1NTUpheokvybCdE6SRASooHmzJlDWloaY8eO5aKLLooLQsFgkPT0dK655poar3O5XFgsFqZNmxbb5vf7efjhh+nVqxdms5nc3Fzuvvtu/H5/3GsVRWHKlCnMmTOHAQMGYDab+fzzzwF49tlnGT58OBkZGVitVoYMGcK//vWvGtf3er3cdtttdOjQgeTkZM477zx2796Noij8+c9/jjt29+7dXHvttWRlZWE2mxkwYABvvPFGvT6fhQsXcsopp5CamkpSUhJHHXUU9913X9wxPp+PP//5z/Tp0weLxUKnTp248MIL2bJlS+wYt9vNH//4R3JzczGbzRx11FE8++yzaJpW78+mMe9j27ZtKIrCN998w7p161AUBUVRWLRoUbOVqy6fffYZp556Kna7neTkZMaOHcu6devijlmzZg2TJk2iR48eWCwWsrOzufbaa9m/f3+N8+3evZvrrruOnJwczGYzeXl53HzzzQQCgbjj/H4/d955J5mZmdjtdi644AL27dt30LIezNtvv82QIUOwWq2kp6dz2WWXsXPnztj+KVOmkJSUhMfjqfHayy+/nOzsbMLhcIM+FyEaTRNCNEjfvn216667TtM0Tfv22281QPvhhx9i+6+99lotNTVV8/v9ca976623NEBbsWKFpmmaFg6HtTPPPFOz2Wza1KlTtb/97W/alClTNIPBoJ1//vlxrwW0fv36aZmZmdojjzyivfzyy9pPP/2kaZqmdenSRfvDH/6gzZgxQ3v++ee1oUOHaoA2f/78uHNccsklGqBdddVV2ssvv6xdcskl2qBBgzRAe/jhh2PHFRYWal26dNFyc3O1Rx99VHv11Ve18847TwO0F1544aCfzdq1azWTyaQdf/zx2vTp07WZM2dq06ZN00477bTYMaFQSDvjjDM0QLvsssu0GTNmaE8++aQ2atQobd68eZqmaZqqqtqoUaM0RVG066+/XpsxY4Z27rnnaoA2derUen02jX0fFRUV2uzZs7W+fftqXbp00WbPnq3Nnj1bKywsbJZy1eWf//ynpiiKdtZZZ2kvvfSS9tRTT2ndu3fXUlNTtfz8/Nhxzz77rHbqqadqjz76qPbaa69pt99+u2a1WrWhQ4dqqqrGjtu9e7eWk5MT+/maOXOm9uCDD2r9+vXTSktLNU3TtFmzZmmAduyxx2qjRo3SXnrpJe2Pf/yjptfrtUsuueSg/9aapmkPP/ywduDXyOOPP64piqJdeuml2iuvvKI98sgjWocOHbTu3bvHrhv9fzN37ty417rdbs1ut2u33HJLgz+X2soiRH3IT40QDfDjjz9qgLZw4UJN0yJf2F26dNFuv/322DELFizQAO3jjz+Oe+3ZZ5+t9ejRI/Z89uzZmk6n0/73v//FHTdz5kwN0JYsWRLbBmg6nU5bt25djTJ5PJ6454FAQDv66KO1UaNGxbatXLmy1i/rSZMm1QhC1113ndapUyetuLg47tjLLrtMczgcNa5X3QsvvKAB2r59++o85o033tAA7fnnn6+xL/pFPm/ePA3QHn/88bj9F110kaYoirZ58+bYtro+m6a8D03TtBEjRmgDBgyI29Yc5apNeXm5lpqaqt1www1x2wsLCzWHwxG3vbZyv/vuuxqgffvtt7FtV199tabT6WLBu7ro5xwNQqNHj44LUXfccYem1+u1srKyg5b7wPCxbds2Ta/Xa3/5y1/ijvvll180g8EQ266qqta5c2dt/PjxccfNnTs37n005HORICQaS5rGhGiAOXPmkJWVxciRI4FI88ell17Ke++9F6vKHzVqFB06dOD999+Pva60tJSFCxdy6aWXxrZ98MEH9OvXj759+1JcXBx7jBo1CoBvvvkm7tojRoygf//+NcpktVrjruN0Ojn11FNZtWpVbHu0SeYPf/hD3GtvvfXWuOeapvHhhx9y7rnnomlaXLnGjBmD0+mMO++Bon1qPvroI1RVrfWYDz/8kA4dOtS4NhC7/fnTTz9Fr9dz2223xe3/4x//iKZpfPbZZ3HbD/xsmvo+6tLUctVl4cKFlJWVcfnll8eVVa/Xc+KJJ8b9LFT/9/b5fBQXF3PSSScBxN6TqqrMmzePc889l+OPP77G9Q68zXzy5Mlx20499VTC4TDbt28/ZNmr+/e//42qqlxyySVx7yM7O5vevXvH3oeiKFx88cV8+umnVFRUxF7//vvv07lzZ0455ZQGfy5CNJbcNSZEPYXDYd577z1GjhxJfn5+bPuJJ57Ic889x1dffcWZZ56JwWBg/PjxvPPOO/j9fsxmM//+978JBoNxQei3335jw4YNZGZm1nq9vXv3xj3Py8ur9bj58+fz+OOPs3r16ri+RdW/2LZv345Op6txjgPvdtu3bx9lZWW89tprvPbaa/UqV3WXXnop//jHP7j++uv505/+xBlnnMGFF17IRRddhE4X+btry5YtHHXUURgMdf/62b59Ozk5OSQnJ8dt79evX2x/dQe+r6a+j5YqV11+++03gFgIPlBKSkpsvaSkhEceeYT33nuvxntwOp1A5P27XC6OPvroel2/a9eucc/T0tKASLBuiN9++w1N0+jdu3et+41GY2z90ksv5cUXX+S///0vEyZMoKKigk8//ZQbb7wx9rPbkM9FiMaSICREPX399dcUFBTw3nvv8d5779XYP2fOHM4880wALrvsMv72t7/x2WefMW7cOObOnUvfvn0ZNGhQ7HhVVRk4cCDPP/98rdfLzc2Ne169JiDqf//7H+eddx6nnXYar7zyCp06dcJoNDJr1izeeeedBr/HaC3OlVdeycSJE2s95phjjqnz9VarlW+//ZZvvvmGTz75hM8//5z333+fUaNG8cUXX6DX6xtcpvo48LNp6vtoqXLVJVre2bNnk52dXWN/9dB4ySWXsHTpUu666y4GDx5MUlISqqpy1lln1VkLdyh1/btoB3QAPxRVVVEUhc8++6zWcyYlJcXWTzrpJLp3787cuXOZMGECH3/8MV6vN+6PhYZ8LkI0lvwUCVFPc+bMoWPHjrz88ss19v373//mP//5DzNnzsRqtXLaaafRqVMn3n//fU455RS+/vpr7r///rjX9OzZk59//pkzzjij0SPifvjhh1gsFhYsWIDZbI5tnzVrVtxx3bp1Q1VV8vPz4/5a37x5c9xxmZmZJCcnEw6HGT16dKPKpNPpOOOMMzjjjDN4/vnneeKJJ7j//vv55ptvGD16ND179mT58uUEg8G4GoIDy/vll19SXl4eV/vy66+/xvYfTHO8j5YoV1169uwJQMeOHQ9a3tLSUr766iseeeQRHnroodj2aM1JVGZmJikpKaxdu7ZR5Wmsnj17omkaeXl59OnT55DHX3LJJUyfPh2Xy8X
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from statistics import mean\n",
"from datetime import datetime\n",
"\n",
"c = db.cursor()\n",
"ratings = list(map(lambda r: r[0], c.execute(\"select distinct Rating from scores\")))\n",
"ratings.sort()\n",
"\n",
"for rating in ratings:\n",
" result = c.execute('select \"Song ID\", UNIXEPOCH(\"Time Played\"), \"Song Name\", Score from scores where Rating = ? order by \"Time Played\"', (rating,))\n",
" scores = dict()\n",
" xs = []\n",
" ys = []\n",
" for record in result:\n",
" song_id, time_played, song_name, score = record\n",
" date = datetime.utcfromtimestamp(time_played)\n",
" scores[song_id] = score\n",
" values = list(scores.values())\n",
" avg = mean(values)\n",
" if len(values) >= 5:\n",
" xs.append(date)\n",
" ys.append(avg)\n",
"\n",
" if xs and ys:\n",
" plt.plot(xs, ys, label=f\"Rating {rating}\")\n",
"\n",
"plt.legend()\n",
"plt.xticks(rotation=45, ha=\"right\")\n",
"plt.title(\"Average score for each level\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 24,
2024-05-02 03:05:34 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time Played\n",
2024-05-04 10:52:52 +00:00
"2024-03-04 29\n",
"2024-05-03 26\n",
2024-05-02 03:05:34 +00:00
"2024-05-01 26\n",
"2024-04-14 24\n",
2024-05-04 10:52:52 +00:00
"2024-04-25 23\n",
"2024-04-13 23\n",
"2024-04-20 20\n",
2024-05-02 03:05:34 +00:00
"2024-04-18 20\n",
2024-05-04 10:52:52 +00:00
"2024-04-24 17\n",
2024-05-02 03:05:34 +00:00
"2024-03-10 17\n",
"Name: Time Played, dtype: int64\n"
]
}
],
"source": [
"JST = pytz.timezone(\"Asia/Tokyo\")\n",
"CST = pytz.timezone(\"America/Chicago\")\n",
"\n",
"def to_jst_timestamp(s: str, format_str=\"%Y-%m-%d %H:%M:%S\"):\n",
" if type(s) is not str: return None\n",
" naive_dt = datetime.strptime(s, format_str)\n",
" jst_dt = JST.localize(naive_dt)\n",
" cst_dt = jst_dt.astimezone(CST)\n",
" return cst_dt\n",
"\n",
"times = data[\"Time Played\"]\n",
"times_mapped = times.map(to_jst_timestamp)\n",
"days_played = times_mapped.groupby(times_mapped.dt.date).count()\n",
"print(days_played.sort_values(ascending=False).head(10))"
]
},
{
"cell_type": "code",
2024-05-04 10:52:52 +00:00
"execution_count": 25,
2024-05-02 03:05:34 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-05-02 03:21:29 +00:00
" Clears Average Max Score Max Score Lamp Max Score Song\n",
"Rating \n",
"8 7 895073 996620 GFC 朧 (dj TAKA Remix)\n",
"9 25 918551 999650 PFC Why not\n",
2024-05-04 10:52:52 +00:00
"10 31 923955 992160 GFC 隅田川夏恋歌\n",
"11 43 897455 992520 GFC 朧\n",
"12 59 892278 987030 GFC MY SUMMER LOVE\n",
"13 72 841207 978430 GFC Struggle\n",
"14 122 800595 943140 FC FUNKY SUMMER BEACH\n",
"15 26 800125 900060 Clear ナイト・オブ・ナイツ\n",
"16 18 772837 861210 Clear Sword of Vengeance\n",
2024-05-02 03:21:29 +00:00
"17 1 662870 662870 Clear PRANA+REVOLUTIONARY ADDICT (U1 DJ Mix)\n"
2024-05-02 03:05:34 +00:00
]
}
],
"source": [
"records_by_level = data.loc[data[\"Lamp\"] != \"Fail\"].groupby(data[\"Rating\"])\n",
"num_clears_by_level = records_by_level[\"Score\"].count().rename(\"Clears\")\n",
"average_scores_by_level = records_by_level[\"Score\"].mean().round().astype(\"int\").rename(\"Average\")\n",
"def max_info(group):\n",
" max_idx = group[\"Score\"].idxmax()\n",
2024-05-02 03:21:29 +00:00
" return group.loc[max_idx][[\"Score\", \"Lamp\", \"Song Name\"]].rename({ \"Score\": \"Max Score\", \"Lamp\": \"Max Score Lamp\", \"Song Name\": \"Max Score Song\" })\n",
"max_score_by_level = records_by_level.apply(max_info)\n",
2024-05-02 03:05:34 +00:00
"result = pd.merge(num_clears_by_level, average_scores_by_level, on=\"Rating\")\n",
"result = pd.merge(result, max_score_by_level, on=\"Rating\")\n",
2024-05-02 03:21:29 +00:00
"with pd.option_context('expand_frame_repr', False):\n",
" print(result)"
2024-05-02 03:05:34 +00:00
]
},
{
"cell_type": "code",
2024-05-04 10:52:52 +00:00
"execution_count": 26,
2024-05-02 03:05:34 +00:00
"metadata": {},
2024-05-02 03:21:29 +00:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Song ID Song Name Difficulty Rating Score Grade Lamp Time Uploaded Time Played\n",
2024-05-04 10:52:52 +00:00
"42 1idIoi66ll806D8ddldOQi8bdiDO0Oil Struggle ESP 13 978430 AA+ GFC 2024-04-18 18:14:49 2024-04-18 18:05:47\n",
"125 9i6dOd608qb0IlqoDIPb8q1o8q1ddQQd FUNKY SUMMER BEACH ESP 14 943140 AA FC 2024-05-01 22:11:00 2024-05-01 19:21:38\n",
"57 1qPIiqqQo0P9dD90I11q90b0ooIidbPO CyberConnect ESP 15 889000 A+ Clear 2024-05-04 04:48:08 2024-05-04 04:24:34\n",
"211 ddqO1b1ldlQd6OOoQ1boPdoboDQqd9D8 Sword of Vengeance ESP 16 861210 A+ Clear 2024-05-01 18:42:28 2024-05-01 18:39:33\n"
2024-05-02 03:21:29 +00:00
]
}
],
"source": [
"# Gold 1\n",
"gold1scores = []\n",
"gold1scores.append(data[(data[\"Score\"] >= 975000) & (data[\"Rating\"] == 13)].head(1))\n",
"gold1scores.append(data[(data[\"Score\"] >= 925000) & (data[\"Rating\"] == 14)].head(1))\n",
"gold1scores.append(data[(data[\"Score\"] >= 875000) & (data[\"Rating\"] == 15)].head(1))\n",
"gold1scores.append(data[(data[\"Score\"] >= 825000) & (data[\"Rating\"] == 16)].head(1))\n",
"gold1scores.append(data[(data[\"Score\"] >= 750000) & (data[\"Rating\"] == 17)].head(1))\n",
"with pd.option_context('expand_frame_repr', False):\n",
" gold1scores = pd.concat(gold1scores)\n",
" print(gold1scores)"
]
2024-05-02 03:05:34 +00:00
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"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",
2024-05-04 10:52:52 +00:00
"version": "3.11.7"
2024-05-02 03:05:34 +00:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}