2024-05-14 05:36:49 发布
网友
我想在PyTables where方法中使用条件表达式。在SQL中,我将使用CASE表达式(PostgreSQL,“CASE WHEN a=b THAN 1 ELSE 0”),如果使用python,我将使用条件表达式“1 WHEN a==b ELSE 0”。但是我找不到如何在PyTableswhere方法中实现它。你知道吗
where
我查过http://pytables.github.io/usersguide/condition_syntax.html,但我不知道这是否可能。你知道吗
您可以使用where(predicate, num1, num2)。你知道吗
where(predicate, num1, num2)
table.where('where(a==b, 1, 0) == c')
根据Conditional Syntax
where(bool, number1, number2): number - number1 if the bool condition is true, number2 otherwise.
您可以使用
where(predicate, num1, num2)
。你知道吗根据Conditional Syntax
相关问题 更多 >
编程相关推荐