Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3989478
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:22:42+00:00 2026-05-20T06:22:42+00:00

I have two 3d numpy arrays a1 and a2 where len(a1) == len(a2) and

  • 0

I have two 3d numpy arrays a1 and a2 where len(a1) == len(a2) and a1[x, y, z] = id

I’m using this code to find out if there is changed data in any of the z layers

eq = a1 == a2
if eq.any():
    #find the indexes of the changed data

as the comment and title says I need to find the indexes of the changed data.
basically I have a list of objects that correspond the the positions in the array and I need to update those objects based on the id pulled form the array. I want to do this as fast as possible as this list can get REALLY large possibly more than 120,000 entries. but only a hundred or so of these entries are likely to change at any one time. as such I’d like to obtain a list of the changed indexes so I can call the object at that index and update it.

I do need to maintain the three components of the index

is there a way to do this without looping through the list? perhaps with numpy.nonzero()

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:22:43+00:00Added an answer on May 20, 2026 at 6:22 am

    Two more options:

    np.argwhere(a1!=a2)
    np.where(a1!=a2)
    

    They both do the same thing but produce results in different formats (one suitable for indexing the arrays, the other more readable)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two equal-length 1D numpy arrays, id and data , where id is
In short: I have two matrices (or arrays): import numpy block_1 = numpy.matrix([[ 0,
Suppose that I have two numpy arrays of the form x = [[1,2] [2,4]
I'm using point sprites in PyOpenGL with numpy and glDrawArrays. So I have two
I have two NumPy arrays, e.g.: a = [1,2,3,4,5] and a filter array, e.g.:
I have two numpy arrays that are OpenCV convex hulls and I want to
I have two Numpy record arrays that have exactly the same fields. What is
I have two numpy arrays X and W each with shape (N,N) that result
I have two equally sized numpy arrays (they happen to be 48x365) where every
I have two 10x2x2 complex64 arrays. I want to find which of the 2x2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.