Python Forum

Full Version: Code problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'm having problems so I hope someone can help. I have two matrices (2d numpy arrays) and I need to make third one by overlapping first two matrices so that result is tuples. So, if first one is M=np.array([[1,2],[5,4]]) and second one N=np.array([[2,6],[9,7]]), third should be (1,2),(2,6) in first row, and (5,9),(4,7) in second row. How can I do that?
I believe that flatten to 1D, pair columnwise and reshape could deliver desired result.
I have this (array([1, 2]), array([2, 6]), array([5, 9]), array([4, 7]). How can I compare elements of each pair, eg. 1 with 2, 2 with 6...?
Do you want to compare for equality or which is bigger/smaller?