Coverage for src/cell_abm_pipeline/tasks/check_data_bounds.py: 0%
14 statements
« prev ^ index » next coverage.py v7.1.0, created at 2024-06-05 19:14 +0000
« prev ^ index » next coverage.py v7.1.0, created at 2024-06-05 19:14 +0000
1import pandas as pd
2from prefect import get_run_logger, task
5@task
6def check_data_bounds(data: pd.DataFrame, bounds: tuple[float, float], description: str) -> bool:
7 logger = get_run_logger()
9 if len(data) == 0:
10 return False
12 if data.max() > bounds[1]:
13 logger.warning(
14 "%s max [ %f ] greater than upper bound [ %f ]", description, data.max(), bounds[1]
15 )
16 return False
18 if data.min() < bounds[0]:
19 logger.warning(
20 "%s min [ %f ] less than lower bound [ %f ]", description, data.min(), bounds[0]
21 )
22 return False
24 return True