Crawford Collins05/01/2020, 7:18 PM
I'm trying to test a @task that returns a dataframe, but assert statement errors on
with Flow("test_target_transformer") as f: te = fit_target_transformer(problem, target, train_data) df = target_encoder_transform(te, imputed_categorical_df) assert df.isna().sum() == 0
. How do I return this as a DataFrame and not a task?
AttributeError: 'FunctionTask' object has no attribute 'isna'
josh05/01/2020, 7:22 PM
with Flow("task-results") as flow: v = get_value() state = flow.run() assert state.result[v].result == ...
Joe Schmid05/01/2020, 7:27 PM
code as defining the structure of the Flow. Without having ever run the Flow yet, there aren't any results available from your tasks, i.e.
doesn't give what you might expect since
is only a placeholder in the definition of the flow. Once you run your Flow, then you can examine the results of a Flow run. (This difference between a Flow and a Flow run can be a little confusing at first but once you understand it, it'll make sense.)
Crawford Collins05/01/2020, 9:52 PM
Jim Crist-Harif05/01/2020, 11:27 PM
@task def my_function(a, b): ... res = my_function.run(a, b) assert res.isna().sum() == 0