-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
25 lines (21 loc) · 759 Bytes
/
Copy pathtest.py
File metadata and controls
25 lines (21 loc) · 759 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
import pandas as pd
from layers.layer1_ingestion.cleaner import clean_dataframe
# Simulate a messy DataFrame
messy_data = {
"First Name": ["Alice", "Bob", " Charlie ", "Alice"], # spaces + duplicate
"Age ": ["25", "30", "not a number", None], # string dtype, bad value
"Salary($)": [50000, 60000, 70000, 50000],
"Unnamed: 0": [1, 2, 3, 4], # meaningless index col
"notes": [None, None, None, None], # 100% empty column
}
df = pd.DataFrame(messy_data)
print("BEFORE cleaning:")
print(df)
print()
result = clean_dataframe(df, use_ai=True)
print("AFTER cleaning:")
print(result["dataframe"])
print()
print("Cleaning log:")
for line in result["log"]:
print(" ", line)