Skip to content

Commit 92f2097

Browse files
committed
remove outliers
1 parent 06eb108 commit 92f2097

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

module-23-evidently/demo/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
DRIFT_THRESHOLD = 0.1
2424
SAMPLE_SIZE = 5000
25+
MAX_PRICE = 1000
2526

2627

2728
def load_and_clean(path: str) -> pd.DataFrame:
@@ -30,7 +31,9 @@ def load_and_clean(path: str) -> pd.DataFrame:
3031
df["price"] = (
3132
df["price"].astype(str).str.replace(r"[\$,]", "", regex=True).astype(float)
3233
)
33-
return df.dropna()
34+
df = df.dropna()
35+
# Drop extreme price outliers so the drift charts show the actual distribution
36+
return df[df["price"] <= MAX_PRICE]
3437

3538

3639
print("Loading data...")

0 commit comments

Comments
 (0)