First of all if I were you, I would add two counters, one for each loop. After the script finishes you should simply print them out. Also note that the counter
Secondly the outer for loop runs your inner loop that compares your data. That way your count is increased for each match the inner loop finds. If you really want to see the real count value, you should put the line of code where you increment the count variable outside the if clause.
import arcpy
gebaudepoints_no = 68
hausnummer_no = 62
count = 0
with arcpy.da.UpdateCursor('hausnummer_cropped5', ['HAUSNR','STRASSE','SHAPE@XY']) as cursor1:
for row1 in cursor1:
count1 += 1
with arcpy.da.UpdateCursor('gebaudepoints_cropped5 - Kopie2', ['ZA3', 'ZA2','GN5','SHAPE@XY']) as cursor2:
count2=0
for row2 in cursor2:
count2 +=1 #this one will increase waaaay too
#much so just set it to zero before the loop and you're good
#but also note that it will show the length of
#the last item in cursor1 within the cursor2
if (row2[0] == row1[0]) and (row2[1] == row1[1]): # and (row2[2] > 0):
#woo! the if condition is met lets print why here
X = row1[2][0]
Y = row1[2][1]
count += 1
cursor2.updateRow([row2[0], row2[1], row2[2], [(X),(Y)]])
#cursor2.deleteRow()
print("Counter for outer loop: "+str(count1)+" and the inner one "+str(count2))
What I would add to your code is, some sort of result printing, so you can display data when your if condition is met. Then you can see what points are missing and print that data out to see why they dont match and change the if clause correctly. So to direct you into where to look on what to print, I would the check values of your row2 list maybe you can find a label to print in there.
Best Answer
Instead of a nested loop, try
itertools.product
.