Python Forum
Write the Matrix2 by using Matrix1
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write the Matrix2 by using Matrix1
#17
(Jan-21-2022, 10:02 AM)ThiefOfTime Wrote: ah ok, i see. the problem is that you are iterating over lists that you alread modified. If I would guess I would say it is this part:
if (rho_final[row][column]==rho[row][column]):
            print('hey')
            # i would leave this part as it is, as it is the fastest way to savely do what you are trying to do. also values that are succesfully found in both lists can be overwritten
            rho[row][column]=m
            rho_final[row][column]=m
well to be more specific the if case. You could try changing it to something like this:
if (not type(rho_final[row][column]) == list and rho_final[row][column]==rho[row][column]):
            print('hey')
            # i would leave this part as it is, as it is the fastest way to savely do what you are trying to do. also values that are succesfully found in both lists can be overwritten
            rho[row][column]=m
            rho_final[row][column]=m
try playing around with it. the problem you are currently having is definately in that par. The
i, j = np.where(rho_final_arr == rho[row][column])
worked for me even when there were lists already present, so I am guessing that this line is the problem

Hello,
I am trying to all possible combination of if and still struggling with the same problem ://. I will try a few more tricks and will tell you
Reply


Messages In This Thread
Write the Matrix2 by using Matrix1 - by quest - Jan-19-2022, 12:20 PM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-19-2022, 11:43 PM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-20-2022, 08:20 AM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-20-2022, 11:37 AM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-20-2022, 11:54 AM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-20-2022, 12:29 PM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-20-2022, 11:18 PM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-20-2022, 11:58 PM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-22-2022, 12:41 AM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-23-2022, 11:57 PM
RE: Write the Matrix2 by using Matrix1 - by quest - Jan-24-2022, 01:07 AM

Forum Jump:

User Panel Messages

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