You're intrinsically limited by the fact that floating point numbers are stored using IEEE 754. You can't have arbitrary precision floating points, so in your case, you can't expect them to necessarily be exactly the same as a string representation.
However, in your case, the more pressing issue is that want to compare a string to a float, so of course they are going to be different. Python is dynamically, but strongly typed.
Given both the above points, you need to better define your problem. Why do you need to compare with an array of strings? (what does this even mean!?)
Can you test for closeness rather than equality once you have your data types sorted out (e.g. using numpy.close
)?