SIENTIAPDE-1005
Add initial implementation of data processing activities and filters
This commit is contained in:
21
scouter/utils/quality/filters.py
Normal file
21
scouter/utils/quality/filters.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from pandas import DataFrame
|
||||
|
||||
|
||||
def check_data_range(value, val_range: list) -> bool:
|
||||
if not value:
|
||||
return True
|
||||
|
||||
bottom = val_range[0]
|
||||
up = val_range[-1]
|
||||
|
||||
return value < bottom or value > up
|
||||
|
||||
|
||||
def out_of_bounds_filter(df: DataFrame, nodes_data_range: dict):
|
||||
return df[df.apply(lambda x: check_data_range(
|
||||
x['value'], nodes_data_range[x['tag']]),
|
||||
axis=1)]
|
||||
|
||||
|
||||
def null_values_filter(df: DataFrame):
|
||||
return df[df['value'].isnull()]
|
||||
Reference in New Issue
Block a user