s.index=[0.0,1.1,2.2,3.3,4.4,5.5]
s.index
# Float64Index([0.0, 1.1, 2.2, 3.3, 4.4, 5.5], dtype='float64')
s
# 0.0 141.125
# 1.1 142.250
# 2.2 143.375
# 3.3 143.375
# 4.4 144.500
# 5.5 145.125
s.index=s.index.astype('float32')
# s.index
# Float64Index([ 0.0, 1.100000023841858, 2.200000047683716,
# 3.299999952316284, 4.400000095367432, 5.5],
# dtype='float64')
What's the intuition behind floating point indices? Struggling to understand when we would use them instead of int indices (it seems like you can have three types of indices: int64, float64, or object, e.g. s.index=['a','b','c','d','e','f']
).
From the code above, it also looks like Pandas really wants float indices to be in 64-bit, as these 64-bit floats are getting cast to 32-bit floats and then back to 64-bit floats, with the dtype
of the index remaining 'float64'
.
How do people use float indicies?
Is the idea that you might have some statistical calculation over data and want to rank on the result of it, but those results may be floats? And we want to force float64
to avoid losing resolution?