1、tile
参考:https://blog.csdn.net/weixin_41998772/article/details/113563806
用法tile(A, reps)
tile是平铺的意思。即将数组A是为瓷砖,在一个二维平面reps平铺开来
0、给定一个数组
from numpy import *
c = array([[1,2],[3,4]])
print(c)
Output:
[[1 2]
[3 4]]
1、横向平铺
print(tile(c,4))
#等效为print(tile(c,(1,4)))
Output:
[[1 2 1 2 1 2 1 2]
[3 4 3 4 3 4 3 4]]
2、纵向平铺
print(tile(c,(3,1)))
Output:
[[1 2]
[3 4]
[1 2]
[3 4]
[1 2]
[3 4]]
3、横向纵向平铺
print(tile(c,(3,4)))
Output:
[[1 2 1 2 1 2 1 2]
[3 4 3 4 3 4 3 4]
[1 2 1 2 1 2 1 2]
[3 4 3 4 3 4 3 4]
[1 2 1 2 1 2 1 2]
[3 4 3 4 3 4 3 4]]
标签:平铺,Python,常规,print,tile,Output,numpy
From: https://www.cnblogs.com/dongfangchun/p/17984714