You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BUG-REPORT] SyntaxError when representing result of a basic operation involving Expression and numpy array, with the array on the right of the operator
#2405
Description
Vaex breaks with a SyntaxError when representing the result of an operation between a vaex DataFrame Expression column and a numpy array of same length, with the Expression being on the left of the operator while the numpy array is on the right of the operator. The error doesn't happen when switching the order of the operands (array on the left and Expression on the right). I am providing a simplified example of this issue in the additional information section.
Software information
Vaex version: 4.17.0
Vaex was installed via: pip
OS: Ubuntu 22.04.3 LTS (under Windows Subsystem Linux)
Numpy version: 1.26.2
Additional information
When generating the following elements:
import vaex as vx
import numpy as np
n_cols = 3
n_rows = 100
ds = vx.from_dict({f"a{i}": np.random.rand(n_rows) for i in range(n_cols)})
the following line generates a SyntaxError:
repr(ds.a0 * np.random.rand(n_rows))
while the following lines do not break:
a = ds.a0 * np.random.rand(n_rows)
repr(np.random.rand(n_rows) * ds.a0)
This happens equally with basic operators +, -, /, //, %, **, >, <, ==, !=, >=, <=, &, | and ^.
edited to correct wrong variable usage in code snippets
The text was updated successfully, but these errors were encountered:
actually produces a numpy array made of n_rows Expression objects, with each i-th Expression corresponding to the i-th element of the random array multiplied by the ds.a0 Expression object. This doesn't feel very intuitive to me, but I may be mistaken about what to expect from this line of code.
Description
Vaex breaks with a
SyntaxError
when representing the result of an operation between a vaex DataFrame Expression column and a numpy array of same length, with the Expression being on the left of the operator while the numpy array is on the right of the operator. The error doesn't happen when switching the order of the operands (array on the left and Expression on the right). I am providing a simplified example of this issue in the additional information section.Software information
Additional information
When generating the following elements:
the following line generates a
SyntaxError
:while the following lines do not break:
This happens equally with basic operators
+
,-
,/
,//
,%
,**
,>
,<
,==
,!=
,>=
,<=
,&
,|
and^
.edited to correct wrong variable usage in code snippets
The text was updated successfully, but these errors were encountered: