In Python, I want to check if certain field values in a dataframe are the correct type. So, I've tried like this:
t2check = isinstance(df['T2'][0], float)
print("t2check={} type={}".format(t2check, type(df['T2'][0])))
the return I got was
t2check=True type=<class 'numpy.float64'>
so: on a check for "float", it returned numpy.float64, and said that was equal. OK.
HOWEVER, on a similar check for an integer value, I get this:
passcheck = isinstance(df['Pass'][0], int)
print("passcheck={} type={}".format(passcheck, type(df['Pass'][0])))
When I run that, I get passcheck=False type=<class 'numpy.int64'>
Here, it says the field value is NOT an "int" - but that it's a numpy.int64.
It doesn't match for me. Why is it loosely equating for floats, and being tight with the definition for int?
I also tried
passcheck64 = isinstance(df['Pass'][0], numpy.int64)
but that returned False as well...