dataset changes
Browse files- .ipynb_checkpoints/Untitled-checkpoint.ipynb +6 -0
- Untitled.ipynb +69 -0
- test.parquet +2 -2
- train.parquet +2 -2
- validation.parquet +2 -2
.ipynb_checkpoints/Untitled-checkpoint.ipynb
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [],
|
3 |
+
"metadata": {},
|
4 |
+
"nbformat": 4,
|
5 |
+
"nbformat_minor": 5
|
6 |
+
}
|
Untitled.ipynb
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
test.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d7d15f2fca0d3cb9627e21613b043a6904cadb37bf98f936af3ec4b0cbb90d8
|
3 |
+
size 82896498
|
train.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:88a5ad815468ad00b014f5835e954a21fba2bfc3e4bad10ca7673d52f71d350c
|
3 |
+
size 881702586
|
validation.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5b3ead9ca401be40cb4c052d6949fc77ad207d9f5d0435fd189073c03cc075a4
|
3 |
+
size 73956486
|