TYP: Return int instead of changing result type in nanops.py
xref #37715

The error was about the lines that set ````result = -1````, which changed the type of result from np.ndarray to int. Changed it to return -1 from the if block since everywhere else its dealing with an np.ndarray
Could you merge master? We have fixed the ci now thanks @kashifkhan 