Formatting the zipped arrays - TypeError: zip argument #1 must support iteration

Formatting the zipped arrays - TypeError: zip argument #1 must support iteration

我想压缩下面的数据,但是我得到类型错误:压缩参数 #1 必须支持迭代。 我已经指出了预期的结果。
有没有人可以帮助我?谢谢

nn_inputs = []
for speed, occupancy, capacity in zip(speed, occupancy,capacity):
    nn_input = zip(int(speed),int(occupancy), float(capacity))
    nn_inputs.append(nn_input)

print nn_inputs


Data input: 

speed = [-24 , -15 , -9 ] 
occupancy = [15, 3, 4] 
capacity = [1.47056441941, 2.12024661067, 2.47288942169 ]



Expected result:

[-24, 15 , 1.47056441941]
[-15, 3  , 2.12024661067]
[-9 , 4  , 2.47288942169]

只需使用zip一次:

>>> speed = [-24 , -15 , -9 ]
>>> occupancy = [15, 3, 4]
>>> capacity = [1.47056441941, 2.12024661067, 2.47288942169 ]
>>> nn_inputs = zip(speed, occupancy, capacity)
>>> nn_inputs
[(-24, 15, 1.47056441941), (-15, 3, 2.12024661067), (-9, 4, 2.47288942169)]

结果是元组列表;如果你想要列表列表,你可以做

>>> nn_inputs = map(list, zip(speed, occupancy, capacity))
>>> nn_inputs
[[-24, 15, 1.47056441941], [-15, 3, 2.12024661067], [-9, 4, 2.47288942169]]