Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
array coding problem
#4
I tried with below and got same result as previous one:

p=np.array([[[0, 1, 2],
[3, 4, 5],
[6, 7, 8]],

[[0, 1, 2],
[3, 4, 5],
[6, 7, 8]],

[[0, 1, 2],
[3, 4, 5],
[6, 7, 8]]])

q=np.array([[0, 2, 1],
[3, 7, 5],
[9, 7, 6]])

Below statement i used to update the value
p[p<q]=130

result:
array([[[ 0, 130, 2],
[ 3, 130, 5],
[130, 7, 8]],

[[ 0, 130, 2],
[ 3, 130, 5],
[130, 7, 8]],

[[ 0, 130, 2],
[ 3, 130, 5],
[130, 7, 8]]])

Hope this will help.....
Reply


Messages In This Thread
array coding problem - by pberrett - May-06-2020, 09:31 AM
RE: array coding problem - by anbu23 - May-06-2020, 10:03 AM
RE: array coding problem - by pberrett - May-06-2020, 12:51 PM
RE: array coding problem - by nnk - May-08-2020, 05:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Access 2D array problem landlord1984 1 3,339 Jan-23-2017, 08:33 AM
Last Post: buran

Forum Jump:

User Panel Messages

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