I have a problem, I would like to keep all decimals when converting string to float. How can I do this? Each time, I have like a round() of values. As you can see, the column named 'price_to_numeric' had less decimal than the column 'price'.
Asked
Active
Viewed 80 times
1
-
Does this answer your question? [Converting object to float loses too much precision - pandas](https://stackoverflow.com/questions/20614658/converting-object-to-float-loses-too-much-precision-pandas) – G. Anderson Oct 21 '21 at 15:53
-
Hi, Please don't post images of code, data, or tracebacks. Copy and paste it as text then format it as code (select it and type ctrl-k). Please [read this](//meta.stackoverflow.com/q/285551) as to why it is discouraged. – Akshay Sehgal Oct 23 '21 at 16:26
1 Answers
0
If you want to convert from string to float (a number with decimals) you can use the float() function. To do this the string just needs to be passed into the function as follows: float('6.5') and the output of the function will be 6.5
If that is what you meant then enjoy, if not please upload the code for us to see.

J Viation
- 38
- 5