I want to use a mask from series x to filter out a vaex dataframe y. I know how to do this in pandas and numpy. In pandas it's like:
import pandas as pd
a = [0,0,0,1,1,1,0,0,0]
b = [4,5,7,8,9,9,0,6,4]
x = pd.Series(a)
y = pd.Series(b)
print(y[x==1])
The result is like:
3 8
4 9
5 9
dtype: int64
But in vaex, the following code doesn't work.
import vaex
import numpy as np
a = np.array([0, 0, 0, 1, 1, 1, 0, 0, 0])
b = np.array([4, 5, 7, 8, 9, 9, 0, 6, 4])
x = vaex.from_arrays(x=a)
y = vaex.from_arrays(x=b)
print(y[x.x == 1].values)
The result is empty:
[]
It seems that vaex doesn't have the same index concept as pandas and numpy. Although the two dataframe is equal shape, array y can't use mask x.x==1.
Is there any way to achieve the equavilent result as pandas does please?
Thanks