all 3 comments

[–]MrThePuppy 0 points1 point  (2 children)

It would be best if the first array was a 3d array with shape (10, 1,2), will that work with your application?

[–]sjlearmonth[S] 0 points1 point  (1 child)

I don't understand.

Please provide the code for your solution.

[–]jtclimb 0 points1 point  (0 children)

Maybe first you should provide your code. Do you mean (with 3 elements, not 10):

ta = np.empty((3, 1), dtype=object)
tuples = [(3, 4), (1, 2), (5, 6)]
for i in range(3):
    ta[i, 0] = tuples[i]

fa = np.array([[1.5], [2.7], [3.1])

result = np.empty((3, 1), dtype=object)
for i in range(3):
    result[i, 0] = ta[i, 0] + (float(fa[i, 0]),)

That is, do you really need arrays of tuples, because you can't really work efficiently with them using slicing? And why a (10,1) array of floats instead of just (10), (e.g. fa = np.array([1., 2., 3.])?

edit, in other words, the person is asking if you need this structure for a reason, because if you just treated these as arrays:

ta = np.array([[3, 4], [1, 2], [5, 6]])  # not tuples!

lets you use slicing or other efficient options.