python/django- number comparison (>) does not work -


this weird. have django program , calling py file views. file read excel , find correct number index given number(target).

it keeps telling me "target number out of range" should not, print out numbers.

for target in target_list:     print target, df[pin_num][end], df[pin_num][0]     if target > df[pin_num][end] or target < df[pin_num][0]:         print target, df[pin_num][end], df[pin_num][0]         print target > df[pin_num][end]         print target < df[pin_num][0]         return "target number out of range" 

the console(using pycharm) show:

23925.85 24472.9 23876.0

23925.85 24472.9 23876.0

true

false

target number out of range

how ever happen? 23925.85 smaller 24472.9 ... , have print out need compare.

so @rawing mentioned in comments, added

print type(target), type(df[pin_num][end]), type(df[pin_num][0])

and showed target string.

so added :

    target=float(target) 

this solve problem.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -