First make sure both units have the same magnitude (V and A, mV and mA etc).
Second, if you force the intercept to zero and switch V with A, so the slope is directly the resistance, the code becomes simply:
import numpy as np
voltage = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
current = np.array([3, 6, 6, 10, 9, 15, 14, 16, 20, 25])
sloperesistance = np.sum(voltage*current)/np.sum(current**2)
print(sloperesistance)