I have to np.arrays which I need to join in a really weird manner. Unfortunately the shapes are givn, I can neither change output nor input.
frequencies =
[100. 200.] (2,)
and
values =
[[1. 2.]
[3. 4.]
[5. 6.]
[7. 8.]] (4, 2)
The required output matrix is:
out =
[[[100. 1.]
[200. 2.]]
[[100. 3.]
[200. 4.]]
[[100. 5.]
[200. 6.]]
[[100. 7.]
[200. 8.]]]
out.shape =
(4, 2, 2)
I just don't have any clue how to solve this problem other than iterating each element in values
in for loops ... but I am sure there is a pythonical / numpyical way ;)