Crawford Collins
05/01/2020, 7:18 PMwith 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
I'm trying to test a @task that returns a dataframe, but assert statement errors on AttributeError: 'FunctionTask' object has no attribute 'isna'
.
How do I return this as a DataFrame and not a task?josh
05/01/2020, 7:22 PMwith Flow("task-results") as flow:
v = get_value()
state = flow.run()
assert state.result[v].result == ...
Joe Schmid
05/01/2020, 7:27 PMwith Flow()...
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. assert df...
doesn't give what you might expect since df
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 Collins
05/01/2020, 9:52 PMJim Crist-Harif
05/01/2020, 11:27 PM.run
attribute:
@task
def my_function(a, b):
...
res = my_function.run(a, b)
assert res.isna().sum() == 0