noxneural commited on
Commit
3b8caf6
1 Parent(s): ea196d1

dataset changes 2

Browse files
Files changed (1) hide show
  1. Untitled.ipynb +0 -69
Untitled.ipynb DELETED
@@ -1,69 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 1,
6
- "id": "f8aa7bfd-d3b4-4a22-a971-985d1c27a28e",
7
- "metadata": {
8
- "tags": []
9
- },
10
- "outputs": [],
11
- "source": [
12
- "import pandas as pd\n",
13
- "import os\n",
14
- "\n",
15
- "def rename_column_in_parquet_files(folder_path):\n",
16
- " # List all Parquet files in the folder\n",
17
- " files = [f for f in os.listdir(folder_path) if f.endswith('.parquet')]\n",
18
- " \n",
19
- " for file in files:\n",
20
- " file_path = os.path.join(folder_path, file)\n",
21
- " \n",
22
- " # Read the Parquet file\n",
23
- " df = pd.read_parquet(file_path)\n",
24
- " \n",
25
- " # Rename the column\n",
26
- " if 'answer' in df.columns:\n",
27
- " df.rename(columns={'answer': 'response'}, inplace=True)\n",
28
- " \n",
29
- " # Write back to Parquet (this will overwrite the existing file, ensure backup if necessary)\n",
30
- " df.to_parquet(file_path)\n",
31
- " else:\n",
32
- " print(f\"No 'answer' column found in {file}\")\n",
33
- "\n",
34
- "# Example usage:\n",
35
- "folder_path = './'\n",
36
- "rename_column_in_parquet_files(folder_path)\n"
37
- ]
38
- },
39
- {
40
- "cell_type": "code",
41
- "execution_count": null,
42
- "id": "452aeb11-2dc0-43f1-ae0d-32e88ea64335",
43
- "metadata": {},
44
- "outputs": [],
45
- "source": []
46
- }
47
- ],
48
- "metadata": {
49
- "kernelspec": {
50
- "display_name": "thesis",
51
- "language": "python",
52
- "name": "thesis"
53
- },
54
- "language_info": {
55
- "codemirror_mode": {
56
- "name": "ipython",
57
- "version": 3
58
- },
59
- "file_extension": ".py",
60
- "mimetype": "text/x-python",
61
- "name": "python",
62
- "nbconvert_exporter": "python",
63
- "pygments_lexer": "ipython3",
64
- "version": "3.11.8"
65
- }
66
- },
67
- "nbformat": 4,
68
- "nbformat_minor": 5
69
- }