How to make append multiple times in for loop to get same results for B like below
import numpy as np
B1 = np.linspace(0,1,7)
B2 = np.linspace(3,8,7)
B = np.append(B1, B2)
B = np.append(B, B2)
B = np.append(B, B2)
B = np.append(B, B2)
B = np.append(B, B2)
so far try something like this but i don't have anny ideas
n = 5
for i in range(n):
B[i] = np.append(B, B2)
您可以使用np.tile()沿某个轴附加多次。
B = np.append( B1, np.tile(B2, (1, 5)) )
n = 5
for i in range(n):
B = np.append(B, B2)
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.