简体   繁体   中英

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. It scales to big data, in constrast to Numpy and has many similar methods. How can I achieve the same effect as numpy.tile on a dask array?

Using dask.array.concatenate() could be a possible workaround.

Demo in 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]])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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