How did you create numTrainInstances?
If seems that its definition is not included in your code snippet.
Anyway, there seem to be just two calls to float, i.e. in this line:
trainAccuracy = (float(numCorrTrain) * 100)/float(numTrainInstances)

Could you add a print statement right before this line and check the types?
print(type(numCorrTrain))
print(type(numTrainInstances))
trainAccuracy = (...