Hail cannot impute type None StructExpression

Hello hail team,
I have a list of StructExpressions after running the random forest training following the gnomad variant qc code. In my list there are two structs generated that have values of None (rf_prediction=None).
INFO (gnomad.variant_qc.random_forest 334): Accuracy: 0.7340060415193779 [Struct(rf_prediction='FP', rf_label='FP', n=12516), Struct(rf_prediction='FP', rf_label='TP', n=708), Struct(rf_prediction='TP', rf_label='FP', n=256), Struct(rf_prediction='TP', rf_label='TP', n=44586), Struct(rf_prediction=None, rf_label='FP', n=12715), Struct(rf_prediction=None, rf_label='TP', n=7014)]

This causes the script to end with
File “/home/ubuntu/venv/lib/python3.6/site-packages/hail/expr/expressions/base_expression.py”, line 194, in impute_type
raise ExpressionException(“Hail cannot impute the type of ‘None’”)
hail.expr.expressions.base_expression.ExpressionException: Hail cannot impute the type of ‘None’

Is there a way to remove these values or update the None to zero to continue the execution of the code?

That log message looks like a list of Structs, not StructExpressions. Something later in the code is likely trying to convert those Structs into StructExpressions and can’t because it doesn’t have enough information to impute the type.

You could manually convert them and supply the necessary type information using hl.literal.

struct_expression = hl.literal(
    struct,
    hl.tstruct(rf_prediction=hl.tstr, rf_label=hl.tstr, n=hl.tint)
)