0

In Vaex, what expression can be used as a filter to select all rows? I wish to create a filter as a variable and pass that to a function.

filter = True
if x > 5:
 filter = y > 20
df['new_col'] = filter & z < 10

My wish is that if x <= 5 it will ignore the filter (thus I'm trying to use True as a value). Doing it this way gives the error 'bitwise_and' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' What expression will select all rows?

afriedman111
  • 1,925
  • 4
  • 25
  • 42

1 Answers1

0

If I understand correctly a simple trick to "disable" all filters (i.e. get all rows back) is to do something like

df[True | filter]

Making the condition always True, so nothing is filtered out.

Joco
  • 803
  • 4
  • 7