Download utils.py from paulus5/techmatik: direct link, hf CLI and curl.
- Browser
- Download file 303 Bytes
-
https://huggingface.co/spaces/paulus5/techmatik/resolve/main/utils.py
- Command line
-
hf download hf://spaces/paulus5/techmatik/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/paulus5/techmatik/resolve/main/utils.py
303 Bytes
| import pandas as pd | |
| import numpy as np | |
| def detect_anomalies(csv_file): | |
| df = pd.read_csv(csv_file) | |
| column = df.columns[0] | |
| values = df[column] | |
| mean = values.mean() | |
| std = values.std() | |
| threshold = mean + 3 * std | |
| df["anomaly"] = values > threshold | |
| return df, threshold |