【发布时间】:2017-04-24 23:50:23
【问题描述】:
我有下面的python代码:
ht_24 = []
ht_23 = []
ht_22 = []
...
all_arr = [ht_24, ht_23, ht_22, ht_21, ht_20, ht_19, ht_18, ht_17, ht_16, ht_15, ht_14, ht_13, ht_12, ht_11, ht_10, ht_09, ht_08, ht_07, ht_06, ht_05, ht_04, ht_03, ht_02, ht_01]
i = 0
j = 0
while i < 24:
while j < 24864:
all_arr[i].append(read_matrix[j+i])
j += 24
print(j)
i += 1
print(i)
其中 read_matrix 是一个形状为 24864, 17 的数组。
我想从不同的起始索引 (0-24) 中读取每 24 行,并将它们附加到每行的相应数组中。请帮忙,这太难了!
【问题讨论】:
-
"形状为 24864, 17 的数组。"你确定不是 24 到 24 的 24864 吗?
标签: python arrays numpy matrix while-loop