"the number of decimal places" is not a property a floating point number has, because of the way they are stored and handled internally.
You can get as many decimal places as you like from a floating point number. The question is how much accuracy you want. When converting a floating point number to a string, part of the process is deciding on the accuracy.
Try for instance:
1.1 - int(1.1)
And you will see that the answer is:
0.10000000000000009
So, for this case, the number of decimals is 17. This is probably not the number you are looking for.
You can, however, round the number to a certain number of decimals with "round":
round(3.1415 - int(3.1415), 3)
For this case, the number of decimals is cut to 3.
You can't get "the number of decimals from a float", but you can decide the accuracy and how many you want.
Converting a float to a string is one way of making such a decision.