What you see is just the default string representation with 6 decimal places. You can set you own display format option with

pd.options.display.float_format = '{:.10f}'.format

to show 10 places. Alternatively you can confirm the number if you look at the result of say df.loc[1,'lng'].

To set the option only temporarily you can use an option context:

with pd.option_context('display.float_format', '{:.10f}'.format):
    print(df)
Answer from Stef on Stack Overflow
๐ŸŒ
IONOS
ionos.com โ€บ digital guide โ€บ websites โ€บ web development โ€บ converting python strings to floats
How to convert Python strings to floats - IONOS
February 1, 2025 - If you want to convert a Python string to a float with NumPy, you can use the function numpy.float64().
Discussions

python - Converting strings to floats in a DataFrame - Stack Overflow
Copydf['MyColumnName'] = df['MyColumnName'].astype('float64') ... This does not work when converting from a String to a Float: ValueError: could not convert string to float: 'date' 2016-06-19T14:56:10.57Z+00:00 More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - How do I parse a string to a float or int? - Stack Overflow
How can I convert an str to a float? "545.2222" -> 545.2222 Or an str to a int? "31" -> 31 For the reverse, see Convert integer to string in Python and Converting a float... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - How to convert an array of strings to an array of floats in numpy? - Stack Overflow
How do I make the following conversion in NumPy? ["1.1", "2.2", "3.2"] โŸถ [1.1, 2.2, 3.2] More on stackoverflow.com
๐ŸŒ stackoverflow.com
How I convert float to string in this case?
You shouldn't call your variable sum, as that's a name of a built in function: https://docs.python.org/3/library/functions.html#sum Your problem however, stems from trying to add a string to a float. Could you please tell me, what is Adam + 5? Well, you can't, because it makes no mathematical sense. You didn't save the string representation str(sum), so sum never changed to a string What your research found is f-strings and they are very easy to use. Try: print(f"the sum of the values is {sum}") Simply, put an f before a string starts, then any string that you want goes between " and ", while any variables or other values go between { and } More on reddit.com
๐ŸŒ r/learnpython
4
2
August 21, 2022
๐ŸŒ
Cherry Servers
cherryservers.com โ€บ home โ€บ blog โ€บ python โ€บ how to convert string to float in python (6 different ways)
How to Convert String to Float in Python (6 Different Ways) | Cherry Servers
February 10, 2026 - It is a popular Python library for scientific computing. It is widely used for advanced mathematical operations, especially when dealing with arrays and matrices. If you're planning to use NumPy for your next project, it is essential to know how to convert strings to floats with this library. Numpy includes a data type called numpy.float64...
๐ŸŒ
iO Flood
ioflood.com โ€บ blog โ€บ convert-string-to-float-python
Convert a String to a Float in Python: 3 Easy Methods
December 11, 2023 - The Pandas library is a powerful tool for data manipulation in Python and can be used to convert strings to floats across an entire DataFrame or Series. import pandas as pd data = pd.Series(['1.23', '4.56', '7.89']) numbers = pd.to_numeric(data) print(numbers) # Output: # 0 1.23 # 1 4.56 # 2 7.89 # dtype: float64 ยท
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ convert-string-to-float-in-python
Convert String to Float in Python - GeeksforGeeks
April 26, 2025 - It converts a string into a Decimal object, effectively avoiding common floating-point rounding errors. ... eval() function reads and runs a string as a Python expression. It can turn a numeric string like "33.28" into a float. However, it's risky to use with untrusted input because it can run harmful code.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ python-convert-string-to-float
How to Convert String to Float in Python: Complete Guide with Examples | DigitalOcean
Learn how to convert strings to floats in Python using float(). Includes syntax, examples, error handling tips, and real-world use cases for data parsing.
๐ŸŒ
AskPython
askpython.com โ€บ python โ€บ string โ€บ python-string-float-conversion
Python String to float, float to String - AskPython
February 28, 2020 - Details object Value float64 dtype: object Details Value 0 John:Pune 21.00 1 Bran:satara 22.00 2 Sam:Chennai 85.24 3 RHEY:Delhi 12.00 4 CRANNY:Karnatak 25.26 Details object Value float64 dtype: object ยท Python String has built-in str() method to convert the input data of any type to the String ...
Find elsewhere
๐ŸŒ
Blueservers
blueservers.com โ€บ blog โ€บ convert-string-to-float-in-python
Convert String to Float in Python (Python String to Float) โžก Blog BlueServers.com
November 4, 2025 - Convert String to Float: The numpy.float64() function is used to convert the string "42.89" into a floating-point number. Output and Type Check: The converted value is printed, along with its data type, which confirms it is a numpy.float64 type instead of a standard Python float.
Top answer
1 of 16
3127
>>> a = "545.2222"
>>> float(a)
545.22220000000004
>>> int(float(a))
545
2 of 16
606

Python2 method to check if a string is a float:

def is_float(value):
  if value is None:
      return False
  try:
      float(value)
      return True
  except:
      return False

For the Python3 version of is_float see: Checking if a string can be converted to float in Python

A longer and more accurate name for this function could be: is_convertible_to_float(value)

What is, and is not a float in Python may surprise you:

The below unit tests were done using python2. Check it that Python3 has different behavior for what strings are convertable to float. One confounding difference is that any number of interior underscores are now allowed: (float("1_3.4") == float(13.4)) is True

val                   is_float(val) Note
--------------------  ----------   --------------------------------
""                    False        Blank string
"127"                 True         Passed string
True                  True         Pure sweet Truth
"True"                False        Vile contemptible lie
False                 True         So false it becomes true
"123.456"             True         Decimal
"      -127    "      True         Spaces trimmed
"\t\n12\r\n"          True         whitespace ignored
"NaN"                 True         Not a number
"NaNanananaBATMAN"    False        I am Batman
"-iNF"                True         Negative infinity
"123.E4"              True         Exponential notation
".1"                  True         mantissa only
"1_2_3.4"             False        Underscores not allowed
"12 34"               False        Spaces not allowed on interior
"1,234"               False        Commas gtfo
u'\x30'               True         Unicode is fine.
"NULL"                False        Null is not special
0x3fade               True         Hexadecimal
"6e7777777777777"     True         Shrunk to infinity
"1.797693e+308"       True         This is max value
"infinity"            True         Same as inf
"infinityandBEYOND"   False        Extra characters wreck it
"12.34.56"            False        Only one dot allowed
u'ๅ››'                 False        Japanese '4' is not a float.
"#56"                 False        Pound sign
"56%"                 False        Percent of what?
"0E0"                 True         Exponential, move dot 0 places
0**0                  True         0___0  Exponentiation
"-5e-5"               True         Raise to a negative number
"+1e1"                True         Plus is OK with exponent
"+1e1^5"              False        Fancy exponent not interpreted
"+1e1.3"              False        No decimals in exponent
"-+1"                 False        Make up your mind
"(1)"                 False        Parenthesis is bad

You think you know what numbers are? You are not so good as you think! Not big surprise.

Don't use this code on life-critical software!

Catching broad exceptions this way, killing canaries and gobbling the exception creates a tiny chance that a valid float as string will return false. The float(...) line of code can failed for any of a thousand reasons that have nothing to do with the contents of the string. But if you're writing life-critical software in a duck-typing prototype language like Python, then you've got much larger problems.

๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ string-to-float-python
6 Ways to Convert String to Float in Python | FavTutor
August 31, 2021 - To convert this list of strings into floating-point values, you have to use for loop to iterate through each item of the list. Later, you can use the float() method to convert each item into float value and then append it to the list again.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how i convert float to string in this case?
r/learnpython on Reddit: How I convert float to string in this case?
August 21, 2022 -

I tried

n1=input('First number')
n2=input('Second number')
sum = float(n1) + float(n2)
str(sum)
print('The sum of the values is: ' + sum)

My error is:

TypeError: can only concatenate str (not "float") to str

I tried googling this error and got some answers like print(f' which I didn't really understand, and some others that looked a little complicated, I am very new.

I am trying to improve my googling skills.

๐ŸŒ
Jeremy Morgan
jeremymorgan.com โ€บ python โ€บ how-to-convert-a-string-to-a-float-in-python
How to Convert a String to a Float in Python - Jeremy Morgan's
December 9, 2023 - The eval() function can be dangerous if used with untrusted input, as it can execute any Python code contained in the string. Therefore, it is recommended to use the float() function for converting strings to floats whenever possible.
๐ŸŒ
YouTube
youtube.com โ€บ watch
How To Convert String To Float In Python - YouTube
In this python tutorial, we answer the question of how to convert string to float in python! In fact, I lay out two methods in which you can turn a string in...
Published: January 19, 2021
๐ŸŒ
Altcademy
altcademy.com โ€บ blog โ€บ how-to-convert-string-to-float-in-python
How to convert string to float in Python - Altcademy.com
June 13, 2023 - Python provides a built-in function called float() that can be used to convert a string to a float.
๐ŸŒ
Mimo
mimo.org โ€บ tutorials โ€บ python โ€บ how-to-convert-string-to-float-in-python
How to Convert String to Float in Python
Learn how to convert strings to floats in Python with float(), clean commas/spaces, handle ValueError safely, and know when to use Decimal.
Top answer
1 of 7
49

You can convert most of the columns by just calling convert_objects:

In [36]:

df = df.convert_objects(convert_numeric=True)
df.dtypes
Out[36]:
Date         object
WD            int64
Manpower    float64
2nd          object
CTR          object
2ndU        float64
T1            int64
T2          int64
T3           int64
T4        float64
dtype: object

For column '2nd' and 'CTR' we can call the vectorised str methods to replace the thousands separator and remove the '%' sign and then astype to convert:

In [39]:

df['2nd'] = df['2nd'].str.replace(',','').astype(int)
df['CTR'] = df['CTR'].str.replace('%','').astype(np.float64)
df.dtypes
Out[39]:
Date         object
WD            int64
Manpower    float64
2nd           int32
CTR         float64
2ndU        float64
T1            int64
T2            int64
T3            int64
T4           object
dtype: object
In [40]:

df.head()
Out[40]:
        Date  WD  Manpower   2nd   CTR  2ndU   T1  ใ€€ใ€€T2   T3     T4
0   2013/4/6   6       NaN  2645  5.27  0.29  407   533  454    368
1   2013/4/7   7       NaN  2118  5.89  0.31  257   659  583    369
2  2013/4/13   6       NaN  2470  5.38  0.29  354   531  473  ใ€€ใ€€383
3  2013/4/14   7       NaN  2033  6.77  0.37  396   748  681    458
4  2013/4/20   6       NaN  2690  5.38  0.29  361   528  541    381

Or you can do the string handling operations above without the call to astype and then call convert_objects to convert everything in one go.

UPDATE

Since version 0.17.0 convert_objects is deprecated and there isn't a top-level function to do this so you need to do:

df.apply(lambda col:pd.to_numeric(col, errors='coerce'))

See the docs and this related question: pandas: to_numeric for multiple columns

2 of 7
41

convert_objects is deprecated.

For pandas >= 0.17.0, use pd.to_numeric

df["2nd"] = pd.to_numeric(df["2nd"])