【发布时间】:2020-03-12 13:05:10
【问题描述】:
我有两个维度为x.shape=(1000000, 2000) 和y.shape=(1000000, 200) 的数组。我想遍历所有列并打印维度为(800, 2000)、(1600, 2000)、...等的数组,一次增加800行。我将如何解决这个问题?
我一直在尝试以下方法:
counter = 0
increment = 800
for i in range(counter+increment):
x[i, :]
y[i, :]
if len(x)==counter && len(x)<10000000:
print(x, y)
counter = counter + increment
但我没有得到我想要的结果
【问题讨论】:
-
我不确定您在寻找什么。具体来说,你为什么提到
y? -
x[i,:]本身在一行上不会做任何事情。它不会改变x。您是否在交互式会话中尝试过小数组?
标签: python numpy for-loop increment