-
Hi,
However, I am running into the following error from the
I can get around the error by simply setting the field to be a numpy array with identical elements using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
This has been working for me: >>> array = ak.Array([{"y": 1}, {"y": 2}, {"y": 3}])
>>> sum = ak.sum(array['y'])
>>> array["x"] = sum
>>> array
<Array [{y: 1, x: 6}, ... x: 6}, {y: 3, x: 6}] type='3 * {"y": int64, "x": int64}'> Considering that I just did a quick check and see that the right-hand-side can be Python numbers ( |
Beta Was this translation helpful? Give feedback.
This has been working for me:
Considering that
sum
is already a defined symbol in Python, and it's a thing that can't be assigned into an ak.Array (<built-in function sum>
), maybe your script is seeing the originalsum
, rather than the output ofak.sum(array['y'])
?I just did a quick check and see that the right-hand-side can be Python numbers (
int
,float
) or NumPy numbers (np.int32
,np.float32
, etc.). That's not the problem.