From 32ae109f661ff4d7453aaa36c6a8d6f7e08f2962 Mon Sep 17 00:00:00 2001 From: Oleg Zakharov Date: Fri, 18 Oct 2024 00:08:45 +0300 Subject: [PATCH] v6 --- Untitled.ipynb | 82 -------------------------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 Untitled.ipynb diff --git a/Untitled.ipynb b/Untitled.ipynb deleted file mode 100644 index c610fb0..0000000 --- a/Untitled.ipynb +++ /dev/null @@ -1,82 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 3, - "id": "58e6167e-1e30-4bbf-93a1-af6ab5cb4673", - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd\n", - "\n", - "def preprocess_test(test_solutions_path: str, test_tasks_path: str, test_tests_path: str, save_path: str) -> None:\n", - " def read_files(*paths):\n", - " return (pd.read_excel(path) for path in paths)\n", - "\n", - " solutions_df, tasks_df, tests_df = read_files(test_solutions_path, test_tasks_path, test_tests_path)\n", - "\n", - " test_dataset = pd.merge(pd.merge(solutions_df, tasks_df, left_on='task_id', right_on='id', how='inner'), \n", - " tests_df, on='task_id', how='inner')\n", - "\n", - " test_dataset['input_output'] = test_dataset.apply(\n", - " lambda row: f\"{row['input']}->{row['output']}\" if pd.notna(row['input']) or pd.notna(row['output']) else \"\", \n", - " axis=1\n", - " )\n", - "\n", - " test_dataset = test_dataset[['id', 'student_solution', 'description', 'author_solution', 'input_output']]\n", - " test_dataset.to_excel(save_path, index=False)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "e561a852-007c-4b78-a7e1-697f80272169", - "metadata": {}, - "outputs": [], - "source": [ - "base = 'data/raw/test/{}'\n", - "\n", - "preprocess_test(base.format('solutions.xlsx'), base.format('tasks.xlsx'), base.format('tests.xlsx'), './test.xlsx')" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "2c15dbb7-1034-41a7-96be-69e2418bf98e", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "d923d6c4-f962-4646-a041-999862bb3950", - "metadata": {}, - "outputs": [], - "source": [ - "preprocess_test(base.format('solutions.xlsx'), base.format('tasks.xlsx'), base.format('tests.xlsx'), './test2.xlsx')" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python [conda env:.conda-poetry]", - "language": "python", - "name": "conda-env-.conda-poetry-py" - }, - "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.11.10" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}