Hl.if_else question

Hello,

I was trying to use hl.if_else to annotate entries, but got an error message.

mt = mt.annotate_entries(GP = hl.if_else( (mt.IMP ==1 | mt.IMP ==2) & hl.argmax(mt.GP) >0.95, mt.GP, hl.missing(hl.int32))

Basically, I was trying to set GP to NA, if argmax(mt.GP) <=0.95 for IMP == 1 or 2.

The error message is ‘TypeError’: and: expected expression of type bool, found Int32Expression of type int32.

I understand the problem here, but how could I resolve it?

Many thanks!

You need parens around the operands of &

Also take a look at or_missing

Worked it out - thanks!