{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "a64f4c1c", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import os\n", "import sys\n", "from pathlib import Path\n", "\n", "workding_dir = str(Path.cwd().parent)\n", "os.chdir(workding_dir)\n", "sys.path.append(workding_dir)\n", "print(\"workding dir:\", workding_dir)\n", "\n", "from dotenv import find_dotenv, load_dotenv\n", "\n", "found_dotenv = find_dotenv(\".env\")\n", "\n", "if len(found_dotenv) == 0:\n", " found_dotenv = find_dotenv(\".env.example\")\n", "print(f\"loading env vars from: {found_dotenv}\")\n", "load_dotenv(found_dotenv, override=True)" ] }, { "cell_type": "code", "execution_count": null, "id": "52701550-0bda-4fa4-959f-2b42eb42e140", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": null, "id": "8cb2dd41-79e1-45bf-a0eb-ff9abc0baa8b", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "df = pd.read_csv(\"cleaned_data_with_categories.csv\")" ] }, { "cell_type": "code", "execution_count": null, "id": "c4e79890-de47-4774-9445-142cff46cf86", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": null, "id": "df3cdbd0-a8b4-4b6e-b5bf-5fdbb7ce93a3", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "df_sorted = df.groupby(\"Category\").count().sort_values(by='id', ascending = False)\n", "df_sorted" ] }, { "cell_type": "code", "execution_count": null, "id": "d3ddee2c-946c-4ee5-b0ba-31ac6d201261", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "# Function to determine the value for the new column\n", "def categorize(value):\n", " if '/' in str(value) or ',' in str(value):\n", " return 'Miscellaneous Events'\n", " else:\n", " return value" ] }, { "cell_type": "code", "execution_count": null, "id": "b470266e-00c1-4d4c-8738-28b4fde2dcc6", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "df['GPT Generated Result'] = df['Category'].apply(categorize)" ] }, { "cell_type": "code", "execution_count": null, "id": "4d5d7300-a663-4394-979e-cf7c5d4f88d5", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "df_sorted1 = df.groupby(\"GPT Generated Result\").count().sort_values(by='id', ascending = False)\n", "df_sorted1" ] }, { "cell_type": "code", "execution_count": null, "id": "6dbe0ac2-4ac6-4d75-9fa7-c856b9370269", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "df.to_csv('result.csv')" ] }, { "cell_type": "code", "execution_count": null, "id": "5dfe7870-c29c-4942-8301-f5e8b1bd9994", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "dc6007d3-c6bd-4bc3-8ccc-099440354ce8", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "eva = pd.read_csv('evaluation_result.csv')\n", "eva" ] }, { "cell_type": "code", "execution_count": null, "id": "a98d47b7-7ab1-4947-a10a-a36fa303dcc1", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "eva['Result_GPT_True_Count'] = eva['Result_GPT'].astype(int) # Convert boolean values to integers\n", "result = eva.groupby(\"GPT Generated Result\")['Result_GPT_True_Count'].sum()\n", "\n", "result_gpt = result.sort_values(ascending=False)\n", "result_gpt" ] }, { "cell_type": "code", "execution_count": null, "id": "ec0defea-c4ad-4f97-9704-23ef83f73ff7", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "test = eva.groupby(\"Category_GoldenResult\").count().sort_values(by='id', ascending = False)\n", "test" ] }, { "cell_type": "code", "execution_count": null, "id": "6bc57f6b-c554-4634-8a98-45d82546d6f8", "metadata": {}, "outputs": [ { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31mFailed to start the Kernel. \n", "\u001b[1;31mUnable to start Kernel 'maritime (Python 3.12.4)' due to a timeout waiting for the ports to get used. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "eva['Result_Golden_True_Count'] = eva['Result_Golden'].astype(int) # Convert boolean values to integers\n", "result = eva.groupby(\"Category_GoldenResult\")['Result_Golden_True_Count'].sum()\n", "\n", "# If you want to sort the result by the count in descending order:\n", "result_golden = result.sort_values(ascending=False)\n", "\n", "result_golden" ] } ], "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.12.4" } }, "nbformat": 4, "nbformat_minor": 5 }