unfortunately, I still have the same error and I do not understand the reason....
here is my new code:
here is my new code:
count = 0 rho_final_arr = np.array(rho_final) for row in range(8): for column in range(8): if row==0 and column==0: count = 0 else: count+=1 if count == 64: count = 63 m = np.zeros((1,64)) m[0][count]=1 #if (not type(rho_final[row][column]) == list and rho_final[row][column]==rho_i[row][column]): #if (rho_final[row][column]==rho_i[row][column]): print(rho_final[row][column],rho_i[row][column]) if not isinstance(rho_final[row][column], list): if (rho_final[row][column]==rho_i[row][column]): #if (np.isclose(rho_final[row][column],rho_i[row][column]))==True: #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_i[row][column]=m rho_final[row][column]=m else: print('heyo') # searching for the symbol in the other list (will be a different object, but the name is the same) # also we are avoiding creating lookup tables or iterating through it more than necessary i, j = np.where(rho_final_arr == rho_i[row][column]) rho_i[row][column]=m rho_final[int(i)][int(j)] = m else: print('heyo 2') # searching for the symbol in the other list (will be a different object, but the name is the same) # also we are avoiding creating lookup tables or iterating through it more than necessary i, j = np.where(rho_final_arr == rho_i[row][column]) rho_i[row][column]=m rho_final[int(i)][int(j)] = m #print(rho_final_arr)