1

Pythonのドキュメントとstackoverflowを読んでもわからないことがあります。多分、考え方が間違っていると思います..

次のように定義済みの 2D Numpy 配列があるとします。

a = np.zeros(shape=(3,2)) 
print a
array([[ 0.,  0.],
       [ 0.,  0.],
       [ 0.,  0.]])

次のように、この 2D 配列の各列に 1D データ配列を (1 つずつ) 挿入したいと思います。

b = np.array([1,2,3])

# Some code, that I just can't figure out. I've studied insert, column_stack, 
# h_stack, append. Nothing seems to do what I need

print a
array([[ 1.,  0.],
       [ 2.,  0.],
       [ 3.,  0.]])

c = np.array([4,5,6])

# Some code, that I just can't figure out. I've studied insert, column_stack, 
# h_stack, append. Nothing seems to do what I need

print a
array([[ 1.,  4.],
       [ 2.,  5.],
       [ 3.,  6.]])

任意の提案をいただければ幸いです!

4

1 に答える 1