python - Conditional expression in PyTables where method -
i want use conditional expression in pytables method. in sql, use case expression (postgresql, "case when a=b 1 else 0"), if usual python, use conditional expression "1 if a==b else 0". couldn't find how can done in pytables where
method.
i checked http://pytables.github.io/usersguide/condition_syntax.html don't know if it's possible.
you can use where(predicate, num1, num2)
.
table.where('where(a==b, 1, 0) == c')
according conditional syntax
where(bool, number1, number2): number - number1 if bool condition true, number2 otherwise.
Comments
Post a Comment