ddr-scores/summary.ipynb

283 lines
136 KiB
Text
Raw Permalink Normal View History

2024-05-02 03:05:34 +00:00
{
"cells": [
{
"cell_type": "code",
2024-05-06 20:48:56 +00:00
"execution_count": 24,
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",
2024-05-06 20:48:56 +00:00
"from IPython.display import Markdown, display\n",
2024-05-04 10:52:52 +00:00
"import sqlite3\n",
"\n",
2024-05-06 06:04:45 +00:00
"plt.rcParams[\"font.family\"] = \"Helvetica Neue\"\n",
"\n",
2024-05-04 10:52:52 +00:00
"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-06 20:48:56 +00:00
"execution_count": 25,
2024-05-04 10:52:52 +00:00
"metadata": {},
"outputs": [
{
2024-05-06 06:04:45 +00:00
"data": {
"text/plain": [
2024-05-06 20:48:56 +00:00
"<Axes: title={'center': '# of scores per session over time'}>"
2024-05-06 06:04:45 +00:00
]
},
2024-05-06 20:48:56 +00:00
"execution_count": 25,
2024-05-06 06:04:45 +00:00
"metadata": {},
"output_type": "execute_result"
2024-05-04 10:52:52 +00:00
},
{
"data": {
2024-05-06 20:48:56 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA8sAAAHTCAYAAAAQ64pwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB+rElEQVR4nO3dd3gU9drG8Ts9IZV0euhFQxMLTVoQkCbSBAso1gMcsR3LUbFgwaMiWHmVI4IoiBRpEZGmIIiCFAHpL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tkk08qIiJCQ4YMkbe3t2bPnq1HHnlE27Zt04QJE+zzhoSEaPTo0ZKkEydOaPz48WrSpIluu+02+zwlPWb5008/1YMPPqjIyEjddtttqlixog4ePKgVK1aoZs2aatu2bYH58/LyNHDgQH377beqWrWqBg8erJCQEO3evVtvvfWWmjVrVqA+Z/I6Wrhwod577z117dpVI0eOVFJSkpYuXarDhw/bx+Hbb7/V4MGD5eHhob59+yo6Olq//PKLXn75Zf32229asGBBgT+6nc1bHKtXr9ZXX32l/v37q1u3blqyZInGjh2rLVu2aOHChQXmdbZ+Z98fZzn7/pT1++/s/G3atLGvM3PnztWmTZsumbc4y+dff/2lzp07q2vXrnrooYf0ww8/aMqUKTp79qymTZvm1PtdknoGDx6sF198Ud99953uvPPOAq+zaNEinTx5Uo888kiB999My9vQoUPVvn17SdLkyZN14MAB+9hdjLPju3r1agUFBalfv36aOnWqWrdurcqVK2vYsGGaOHGiHnnkEf3000/2+Uvy/gBAsdkAwAWsWLHCNnPmTNuYMWNskmyPP/64bebMmbbnn3/eJsn23HPP2WbOnGmbOXOmLT093enXT0xMtHl7e9uCgoJshw4dsk8/ceKELSYmxibJtmHDhiKfu2/fPpsk25AhQ4obr0gtWrSwSbJt3769wPScnBzbvn37Cs0/YcIEmyRbu3btbGfOnCnw2IEDB2xbt2613y9u3tGjR9sk2by9vW0//PBDgccyMzNtx48ft9lsNltSUpItICDAFhwcXKj+Bx54wCbJ9vXXX5corzPyx0iSbcqUKfbpZ8+etd188802SbbvvvvOPr049dtsV/7+FIcz7095vP8lGa8hQ4bYJF10PmeXzwvHd/bs2fbpmZmZtpiYGJunp6ft1KlTl6zpUpytZ/fu3TZJth49ehR6rQEDBtgk2TZv3myfZsblLV+7du1szv65eLnxrVGjhi0iIsKWm5trs9n+tyzlvyeDBw+2eXt72x8v7vsDACXFbtgAXEK7du3Ur18/+fn5SZJGjRqlfv36ydvbW25ubnrsscfUr18/9evXTxUqVHD69b/77jtlZ2frnnvuUdWqVe3Tg4ODNW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lcW1ZZ96f8nj/y3K8zLY+FqeeqKgodezYUcuXL1dycrJSU1O1ePFitW7dWtWrVy8wrxmXNzMp6fsDAMVFswzA9Pbv3y+bzabXX39dkpSYmCibzaYXX3xRHh4eOnnypP0PpuLKP573jz/+KPRY/rQLj/ktbwEBAerSpYvmzZun+vXr688//7T/kS6d+0O9QYMGOnr0qLZs2XLZ1yvrvNdff70k6ddffy3W8y+Xt7i2bNli31qVb/PmzZLOHe+ar6T1l7XLvT/l/f6X9niZbX0sbj2DBw9Wbm6uZs6cqdmzZys7O7vQ2bElcy9v+YctlOSSfCVl5vcHgLXRLANwGcuWLVOjRo0UFRVlv9+8eXP7VtWS6NWrl7y9vTVlyhTt3bvXPv3o0aP68MMPJUn9+vUr8f/jjGXLlhX6AuD48eM6evSofHx85O/vX+Cxhx9+WJL0z3/+s9B1g48cOaK//vrLfr+s895zzz3y8/P
2024-05-04 10:52:52 +00:00
"text/plain": [
2024-05-06 06:04:45 +00:00
"<Figure size 1200x500 with 1 Axes>"
2024-05-04 10:52:52 +00:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from datetime import date, datetime\n",
2024-05-06 06:04:45 +00:00
"import july\n",
"from july.utils import date_range\n",
"from utils import CST\n",
2024-05-04 10:52:52 +00:00
"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",
2024-05-06 06:04:45 +00:00
"dates = list(map(lambda x: datetime.utcfromtimestamp(x).astimezone(tz=None), x))\n",
2024-05-04 10:52:52 +00:00
"# dates = matplotlib.dates.date2num(x)\n",
2024-05-06 06:04:45 +00:00
"# 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()\n",
"july.heatmap(dates, y, title='# of scores per session over time',\n",
" # cmap='Pastel1',\n",
" # date_label=True,\n",
" value_label=True,\n",
" month_grid=True,\n",
")"
2024-05-04 10:52:52 +00:00
]
},
{
"cell_type": "code",
2024-05-06 20:48:56 +00:00
"execution_count": 26,
2024-05-04 10:52:52 +00:00
"metadata": {},
"outputs": [
{
"data": {
2024-05-06 20:48:56 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiUAAAIWCAYAAACIg/3oAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAD4LUlEQVR4nOydd5wU5f3H37N993rlaFfoICiggFgQFRvYey8xGiMxIWos/EyAxKhYogmaGCyowShRQI0aRUURC6BSpUg77o5yjeu3fef5/TG7e7tXuNvj7nbv7nm/XvuamWeemXl2dnbmM9/n+3y/ihBCIJFIJBKJRBJldNFugEQikUgkEglIUSKRSCQSiSRGkKJEIpFIJBJJTCBFiUQikUgkkphAihKJRCKRSCQxgRQlEolEIpFIYgIpSiQSiUQikcQEUpRIJBKJRCKJCaQokUgkEolEEhNIUSKRSGKWgwcPcu2119KvXz8URUFRFF555ZVoN6vbsG/fPhRF4eabb+6U/b/yyivB3yXw+eKLLzrlWJ1Bd29/T8QQ7QZIosdbb73FlVdeCcCiRYs67cYlkbSXm2++mU8//ZRrrrmGIUOGoCgKY8eOjXazJH7Gjh3LnDlzAPjiiy9YtWpVlFsUGd29/T0RKUp6McuWLSMrKwuTycSyZcukKJHEFC6Xi88++4xp06bx+uuvR7s5kmYYO3ZsUCTOnTu32z3Uu3v7eyJSlPRSXC4XH374IZdeeilms5lXX32Vuro64uPjo900iQSAkpISVFWlX79+0W6KRCLpIqRPSS/ls88+o6amhnPPPZdzzz0Xp9PJ//73vyb1Ro4cic1mo66ursk6l8tFcnIyOTk5NE42/cMPP3D55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LiYmEymURiYqIoKioKlldVVYnc3FwBiPXr1zc5RlvPf1ecnwCBB+pNN93UYp3O/r6R0p7zE8n1LERk10PgHAJi2bJlYd8xNzdXGAwGUVNT067v2pi2PNQjPT9ddf9pa/slnY/svumFfPXVV5SVlXHeeecFy8477zxqamr49NNPw+oOHjyYiRMnsmLFCiorK4Pl9fX1vP/++4wZM4YxY8YEywO+Kffccw8jRowI29fvfvc7AP7zn/+02LZLL72Us846K6zMbDaTkpISXJ4yZQqKooTVMRqNnHPOOQBs3rw5WL5kyRKEEMycOZPExMRg+amnnsrEiRObHP9o298WvF5v8HuFYjAYyM3NbVL/H//4BwDPPvssVqs1bF12djajRo0KLr/77ru43W5uvPFGBgwYECxPSkriV7/6FQBvv/12i21r7fx3xfmJhM7+vpHSnvMTyfUMkV0PAY455hguueSS4LLZbOa8887D6/UedVdVJER6frr6/iOJPtLRtReybNkygCai5P7772f58uXMmDEjrP61117LunXrWLZsGbfeeiugPQzsdjvXXnttWN1169YB8NNPPzF37tywdYGH8c6dO1tsW+MHRHPs27ePxx57jM8++4z9+/fjdDrD1of2k2/ZsgWAcePGNdnP2LFjg+3tqPa3hSuuuIKNGzdy2mmnce2113LyySdz/PHHN+vQWVdXx/bt28nMzGT06NGt7nvbtm0AjB8/vsm6wDkI1GmO1s5/V5yfSOjs7xsp7Tk/kVzPkV4PARo/oAEyMjKa7L+zac/56cr7jyT6SFHSC1m+fDmKovDGG2/w5ptvBsv1ej3vvfcePp8PvV4fLL/66qu55557ePPNN4M3hTfffBNFUZrcFKqqqgCOOISzvr6+xXUDBw48Ytv37t3LhAkTqKysZMqUKUyfPj34VhuIMxC4+UDDDTc9Pb3JvtLS0pqUHW3728KDDz5IRkYGL730Ek8++STz588H4JRTTuGll15i2LBhwbrV1dUA9O3bt037DjgENvfdAufgSA+h1s5/V5yfSOjs7xspkZ6fSK/nSK+HAM2NqgtYZ0QLzrSdQXuun668/0iijxQlvYzvvvuOoqIiAP7yl780WV9WVsbq1auZOnVqsKxPnz6cccYZrFy5ktLSUoxGIx9//DEnn3wy2dnZYdsnJSUB8M033zB58uSI22c0Go+4/i9/+QsVFRW8+OKLwRtUgF/+8pdN4gwkJCQAUF5e3mRfhw8fblJ2tO1vC4qicNttt3HbbbdRV1fH119/zbPPPsv777/PZZddFrTuAMEup4MHD7Zp34GHT3PfLXAOAuekOVo7/11xfiKhs79vpER6fiK9niO9HmKN9lw/XXn/kUQf6VPSy1i+fDkAS5cuRWiOzsHPe++9F1YnlGuvvRafz8dbb73FsmXLcLvdXHfddU3qTZgwAdCGH3YGu3fvBghGog2lcVcMEOxvXr9+fZN1GzZsaFLW2e1vTHx8POeccw7vvfcew4cP58cffwwTUAkJCYwYMYKysrIwsdISAX+C5r5boKw5n4O20tXnpzU6+/tGSqTnJ9LrOdLroSsJiD+73d5infZeP11x/2lL+yVdQDS9bCVdz4gRI4ROp2t2dEFNTY0wGAxi4MCBTdZVV1cLi8UiTjnlFDFt2jRhNBpFeXl5k3oHDx4UVqtVpKWliW3btjVZX1BQIDZt2tSkvK2e77/4xS8E0GTExIIFC4KjDBYtWhQsD4y+yc3NDRt9s2rVqmZH37S3/ZHw2WefNRltUV5eLlJTU4XZbG4youKZZ54RgJg6dWqTdQcPHgwbZXDo0CFhMplEUlKS2LNnT7C8tLRU5OXltToapbXz3xXnJ0BbRt909veNlEjPT6TXsxCRXQ9HOocdfQ7eeecdAYj/+7//a7FOe6+fzr7/tLX9ks5HipJexNatWwUgjj/++BbrnHLKKQIQ69ata7LusssuE4qiCL1e3+wQvQBvvvmmMBqNwmg0iosvvljcd9994q677hKTJ08WOp1OPP300022aesNctOmTcJkMgmbzSZuueUWcc8994jTTjtNGI1GcfbZZzd7Ew+NU3LPPfeIX/ziFyIuLk5
2024-05-04 10:52:52 +00:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from statistics import mean\n",
"from datetime import datetime\n",
2024-05-06 06:04:45 +00:00
"from matplotlib.scale import ScaleBase, register_scale\n",
"from matplotlib.transforms import Transform\n",
"from matplotlib.axis import YAxis\n",
"\n",
2024-05-04 10:52:52 +00:00
"\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",
2024-05-06 06:04:45 +00:00
" result = list(result)\n",
2024-05-04 10:52:52 +00:00
" scores = dict()\n",
" xs = []\n",
" ys = []\n",
" for record in result:\n",
2024-05-06 06:04:45 +00:00
" song_id = record[0]\n",
" scores[song_id] = 0\n",
" for record in result:\n",
2024-05-04 10:52:52 +00:00
" 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",
2024-05-06 06:04:45 +00:00
" xs.append(date)\n",
" ys.append(avg)\n",
2024-05-04 10:52:52 +00:00
"\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",
2024-05-06 06:04:45 +00:00
"plt.yscale('log')\n",
2024-05-04 10:52:52 +00:00
"plt.title(\"Average score for each level\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-05-06 20:48:56 +00:00
"execution_count": 27,
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-06 06:04:45 +00:00
"2024-05-04 28\n",
2024-05-02 03:05:34 +00:00
"2024-04-14 24\n",
2024-05-06 06:04:45 +00:00
"2024-05-03 24\n",
"2024-05-01 23\n",
"2024-04-13 22\n",
2024-05-02 03:05:34 +00:00
"2024-04-18 20\n",
2024-05-06 06:04:45 +00:00
"2024-04-25 20\n",
"2024-04-20 18\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",
2024-05-06 20:48:56 +00:00
"result = days_played.sort_values(ascending=False).head(10)\n",
"display(Markdown(result.to_markdown()))"
2024-05-02 03:05:34 +00:00
]
},
{
"cell_type": "code",
2024-05-06 20:48:56 +00:00
"execution_count": 28,
2024-05-02 03:05:34 +00:00
"metadata": {},
"outputs": [
{
2024-05-06 20:48:56 +00:00
"data": {
"text/markdown": [
"| Rating | Clears | Average | Max Score | Max Score Lamp | Max Score Song | Min Score | Min Score Lamp | Min Score Song |\n",
"|---------:|---------:|----------:|------------:|:-----------------|:-------------------|------------:|:-----------------|:---------------------------------------|\n",
"| 8 | 7 | 895073 | 996620 | GFC | 朧 (dj TAKA Remix) | 685090 | Clear | RED ZONE |\n",
"| 9 | 25 | 918551 | 999650 | PFC | Why not | 730730 | Clear | Clarity |\n",
"| 10 | 31 | 924433 | 992160 | GFC | 隅田川夏恋歌 | 779880 | Clear | 初音ミクの消失 |\n",
"| 11 | 44 | 899018 | 992520 | GFC | 朧 | 728300 | Clear | Bad Apple!! feat. nomico |\n",
"| 12 | 62 | 897328 | 987030 | GFC | MY SUMMER LOVE | 765380 | Clear | Life is beautiful |\n",
"| 13 | 74 | 843144 | 978430 | GFC | Struggle | 619400 | Clear | ラキラキ |\n",
"| 14 | 125 | 801284 | 960440 | FC | FUNKY SUMMER BEACH | 666000 | Clear | Pluto The First |\n",
"| 15 | 27 | 802587 | 917120 | Clear | Toy Box Factory | 684060 | Clear | ENDYMION |\n",
"| 16 | 19 | 779613 | 862810 | Clear | Life is beautiful | 691570 | Clear | PRANA |\n",
"| 17 | 3 | 724233 | 765430 | Clear | Elemental Creation | 662870 | Clear | PRANA+REVOLUTIONARY ADDICT (U1 DJ Mix) |"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
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-06 20:48:56 +00:00
" min_idx = group[\"Score\"].idxmin()\n",
" max_score = group.loc[max_idx][[\"Score\", \"Lamp\", \"Song Name\"]].rename({ \"Score\": \"Max Score\", \"Lamp\": \"Max Score Lamp\", \"Song Name\": \"Max Score Song\" })\n",
" min_score = group.loc[min_idx][[\"Score\", \"Lamp\", \"Song Name\"]].rename({ \"Score\": \"Min Score\", \"Lamp\": \"Min Score Lamp\", \"Song Name\": \"Min Score Song\" })\n",
" return pd.concat([max_score, min_score])\n",
2024-05-02 03:21:29 +00:00
"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",
2024-05-06 20:48:56 +00:00
" display(Markdown(result.to_markdown()))"
2024-05-02 03:05:34 +00:00
]
},
{
"cell_type": "code",
2024-05-06 20:48:56 +00:00
"execution_count": 29,
2024-05-02 03:05:34 +00:00
"metadata": {},
2024-05-02 03:21:29 +00:00
"outputs": [
{
2024-05-06 20:48:56 +00:00
"data": {
"text/markdown": [
"| | Song ID | Song Name | Difficulty | Rating | Score | Grade | Lamp | Time Uploaded | Time Played |\n",
"|----:|:---------------------------------|:-------------------|:-------------|---------:|--------:|:--------|:-------|:--------------------|:--------------------|\n",
"| 44 | 1idIoi66ll806D8ddldOQi8bdiDO0Oil | Struggle | ESP | 13 | 978430 | AA+ | GFC | 2024-04-18 18:14:49 | 2024-04-18 18:05:47 |\n",
"| 128 | 9i6dOd608qb0IlqoDIPb8q1o8q1ddQQd | FUNKY SUMMER BEACH | ESP | 14 | 960440 | AA+ | FC | 2024-05-05 05:34:41 | 2024-05-05 05:22:53 |\n",
"| 59 | 1qPIiqqQo0P9dD90I11q90b0ooIidbPO | CyberConnect | ESP | 15 | 903280 | AA | Clear | 2024-05-05 02:40:07 | 2024-05-05 02:32:47 |\n",
"| 112 | 90lolio9qd6qo6Pl8oo69iqi81oiiQib | I'm so Happy | CSP | 16 | 839540 | A | Clear | 2024-05-05 02:19:22 | 2024-05-05 02:14:35 |\n",
"| 347 | OiIOPd80d9PQQIbidO6ObioboO88OD9l | Elemental Creation | ESP | 17 | 765430 | B+ | Clear | 2024-05-05 05:34:41 | 2024-05-05 05:12:27 |"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
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",
2024-05-06 20:48:56 +00:00
" display(Markdown(gold1scores.to_markdown()))"
2024-05-02 03:21:29 +00:00
]
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-17 06:01:12 +00:00
"version": "3.11.7"
2024-05-02 03:05:34 +00:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}