I have a tree with one branch storing a string.
When I read using uproot.open()
and then the method arrays()
I get the following:
>>> array_train['backtracked_end_process']
<ObjectArray [b'FastScintillation' b'FastScintillation' b'FastScintillation' ... b'FastScintillation' b'FastScintillation' b'FastScintillation'] at 0x7f48936e6c90>
I would like to use this branch to create masks, by doing things like
array_train['backtracked_end_process'] != b'FastScintillation'
but unfortunately this produces an error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-97-a28f3706c5b5> in <module>
----> 1 array_train['backtracked_end_process'] == b'FastScintillation'
~/.local/lib/python3.7/site-packages/numpy/lib/mixins.py in func(self, other)
23 if _disables_array_ufunc(other):
24 return NotImplemented
---> 25 return ufunc(self, other)
26 func.__name__ = '__{}__'.format(name)
27 return func
~/.local/lib/python3.7/site-packages/awkward/array/objects.py in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
216 contents.append(x)
217
--> 218 result = getattr(ufunc, method)(*contents, **kwargs)
219
220 if self._util_iscomparison(ufunc):
~/.local/lib/python3.7/site-packages/awkward/array/jagged.py in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
987 data = self._util_toarray(inputs[i], inputs[i].dtype)
988 if starts.shape != data.shape:
--> 989 raise ValueError("cannot broadcast JaggedArray of shape {0} with array of shape {1}".format(starts.shape, data.shape))
990
991 if parents is None:
ValueError: cannot broadcast JaggedArray of shape (24035,) with array of shape ()
Does anyone have any suggestion on how to proceed? Being able to transform it to a numpy.chararray
would already solve the problem, but I don't know how to do that.