Vincent Claes commited on
Commit
1315f1b
1 Parent(s): 81feeba

add data processing script

Browse files
Files changed (1) hide show
  1. scripts/process-data.py +33 -0
scripts/process-data.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ # download parquet file from here: https://huggingface.co/datasets/Sachinkelenjaguri/Resume_dataset
3
+ # asked chatgpt to write me a script to convert and deduplicate
4
+ """
5
+ import pandas as pd
6
+
7
+ # Step 1: Read the parquet file
8
+ df = pd.read_parquet('/Users/vincent/Downloads/csv-train.parquet')
9
+
10
+ if 'Category' in df.columns:
11
+ unique_classes = df['Category'].unique()
12
+ print("Unique classes in 'Category' column:")
13
+ for cls in unique_classes:
14
+ print(cls)
15
+ else:
16
+ print("'Category' column does not exist in the data.")
17
+
18
+ # Step 2: Check if 'Resume' column exists
19
+ if 'Resume' in df.columns:
20
+ # Keep only the 'Resume' column
21
+ print(df.shape)
22
+ df = df.drop_duplicates(subset=['Resume'])
23
+ print(df.shape)
24
+ df = df[['Resume']]
25
+ # Remove all the new lines from each cell of the 'Resume' column
26
+ df['Resume'] = df['Resume'].replace('\n',' ', regex=True)
27
+ else:
28
+ print("'Resume' column does not exist in the data.")
29
+
30
+ # Step 3: Write the filtered dataframe back to a csv file
31
+ df.to_csv('/Users/vincent/Downloads/output.csv', index=False, header=False)
32
+
33
+ print("Completed successfully")