Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code problems
#1
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?
Reply
#2
I believe that flatten to 1D, pair columnwise and reshape could deliver desired result.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
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...?
Reply
#4
Do you want to compare for equality or which is bigger/smaller?
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020