简体   繁体   English

什么是numpy.tile的dask等价物?

[英]What is the dask equivalent of numpy.tile?

Dask ( http://dask.pydata.org/en/latest/array-api.html ) is a flexible parallel computing library for analytics. Dask( http://dask.pydata.org/en/latest/array-api.html )是一个灵活的分析计算库。 It scales to big data, in constrast to Numpy and has many similar methods. 它可以扩展到大数据,与Numpy相比,并且有许多类似的方法。 How can I achieve the same effect as numpy.tile on a dask array? 如何在dask数组上实现与numpy.tile相同的效果?

Using dask.array.concatenate() could be a possible workaround. 使用dask.array.concatenate()可能是一种可能的解决方法。

Demo in NumPy: NumPy演示:

In [374]: x = numpy.arange(4).reshape((2, 2))

In [375]: x
Out[375]: 
array([[0, 1],
       [2, 3]])

In [376]: n = 3

In [377]: numpy.tile(x, n)
Out[377]: 
array([[0, 1, 0, 1, 0, 1],
       [2, 3, 2, 3, 2, 3]])

In [378]: numpy.concatenate([x for i in range(n)], axis=1)
Out[378]: 
array([[0, 1, 0, 1, 0, 1],
       [2, 3, 2, 3, 2, 3]])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM