-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean_csv.py
More file actions
38 lines (28 loc) · 985 Bytes
/
Copy pathclean_csv.py
File metadata and controls
38 lines (28 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pandas as pd
def process_csv(file_path, columns_to_keep):
df = pd.read_csv(file_path)
print("Columns in the CSV file:")
print(df.columns.tolist())
df = df[columns_to_keep]
print("\nDataFrame after keeping only the specified columns:")
print(df.head())
null_rows = df.isnull().any(axis=1)
if null_rows.any():
print("\nRows with null values:")
print(df[null_rows])
else:
print("\nNo rows with null values found.")
zero_rows = (df == 0).any(axis=1)
if zero_rows.any():
print("\nRows with zero values:")
print(df[zero_rows])
else:
print("\nNo rows with zero values found.")
df.to_csv("dataset/llvm-ir-loop-optimized-llvm-ir-.csv", index=False)
print("\nModified CSV saved as 'llvm-ir-loop-optimized-llvm-ir-.csv'.")
file_path = "dataset/llvm-irs-loop-optimized.csv"
columns_to_keep = [
"llvm-ir",
"llvm-optimized-ir",
]
process_csv(file_path, columns_to_keep)