根据答案https://stackoverflow.com/a/5347492/7505395改编为Interweaving two numpy arrays:
(Note that a UnionArray may be the best way to interleave two arrays, even if they have the same type. Heterogeneity is not a necessary feature of a UnionArray.) Numpy has a dtype=object for arrays of Python objects, but Awkward's ObjectArray creates Python objects on demand from array...
We should not interleave numpy‘s vectorized operation along with a Python loop. This slows down performance drastically, as the code is iterating using native Python. 我们不应该将 numpy的向量化操作与Python循环一起插入。 由于代码正在使用本机Python进行迭代,因此这会极大地降低性能。 For example, the...
(Note that a UnionArray may be the best way to interleave two arrays, even if they have the same type. Heterogeneity is not a necessary feature of a UnionArray.) Numpy has a dtype=object for arrays of Python objects, but awkward's ObjectArray creates Python objects on demand from array...