I have a list of floats (actually this is a pandas Series object if it changes something) that looks like this:
mySeries:
...
22 16.0
23 14.0
24 12.0
25 10.0
26 3.1
...
(So, the elements of this series on the right, the indices on the left.) Then I try to assign the elements from this Series as keys in the dictionary and indexes as values, for example:
{ mySeries[i]: i for i in mySeries.index }
and I get what I wanted, besides ...
{ 6400.0: 0, 66.0: 13, 3.1000000000000001: 23, 133.0: 10, ... }
Why did it 3.1suddenly change to 3.1000000000000001? I guess this has to do with how floating point numbers (?) Are represented, but why is this happening now and how do I avoid / fix it?
EDIT: Please feel free to suggest a better name for this question if it is inaccurate.
EDIT2: , , , -. , mySeries[26] , :
myDict[mySeries[26]]
KeyError. ?