Improve the handling of data frames (TestManager)
Overview
Description
It would be nice if you can define the column that should be considered if you pass a data frame to a test manager (also for test sequences and test groups). This extension would avoid that you have to convert the column to a series before passing it to the manager.
Reported by
Romy Fößig (KIT) & Nicole Büttner (KIT)
Solved
TestManager
from autom8qc.qaqc.base import TestManager
import numpy as np
import pandas as pd
from autom8qc.core.structures import DataFrame
from autom8qc.qaqc.base import TestManager
from autom8qc.qaqc.limit import GlobalMinimumTest
index = pd.date_range(start="1/1/2021", end="1/10/2021")
values = {
"test_a": [10, np.nan, np.nan, 23, 35, 32, 27, 33, 34, 32],
"test_b": [30, 30, 30, 23, 35, 32, 27, 33, 34, 32],
}
data = DataFrame(name="Test", data=pd.DataFrame(values, index=index))
test = GlobalMinimumTest(min_val=25)
options = {"columns": ["test_a"]}
manager = TestManager(data=data, test=test, filter_options=options)
print(manager.perform())
TestSequence
from autom8qc.mappers.validities import StandardValidityMapper
from autom8qc.qaqc.base import TestManager
import numpy as np
import pandas as pd
from autom8qc.core.structures import DataFrame
from autom8qc.qaqc.base import TestSequence
from autom8qc.qaqc.limit import GlobalMinimumTest
index = pd.date_range(start="1/1/2021", end="1/10/2021")
values = {
"test_a": [10, 20, 27, 23, 35, 32, 27, 33, 34, 32],
"test_b": [30, 30, 30, 23, 35, 32, 27, 33, 34, 32],
}
data = DataFrame(name="Test", data=pd.DataFrame(values, index=index))
test = GlobalMinimumTest(min_val=25)
options = {"columns": ["test_a"]}
sequence = TestSequence(data=data, filter_options=options)
sequence.add_test(test=test, threshold=0.5, name="Global Test")
sequence.perform()
sequence.plot()
Edited by m.kennert