About 107,000 results
Open links in new tab
  1. python - How do I parse a string to a float or int? - Stack Overflow

    Dec 19, 2008 · I just want to know how to parse a float string to a float, and (separately) an int string to an int. It's good that you ask to do these separately. If you're mixing them, you may be …

  2. Checking if a string can be converted to float in Python

    Apr 10, 2009 · I've got some Python code that runs through a list of strings and converts them to integers or floating point numbers if possible. Doing this for integers is pretty easy if …

  3. python - How do I convert all of the items in a list to floats? - Stack ...

    float(item) do the right thing: it converts its argument to float and and return it, but it doesn't change argument in-place. A simple fix for your code is: new_list = [] for item in list: …

  4. How can I convert a string with dot and comma into a float in …

    Jul 9, 2011 · How can I convert a string like 123,456.908 to float 123456.908 in Python? For int s, see How to convert a string to a number if it has commas in it as thousands separators? , …

  5. python - Converting strings to floats in a DataFrame - Stack …

    May 30, 2017 · NOTE: pd.convert_objects has now been deprecated. You should use pd.Series.astype(float) or pd.to_numeric as described in other answers. This is available in …

  6. Python convert string to float - Stack Overflow

    how can i convert string to float in python 3. 2. Change String to Float Python. 1.

  7. python - Converting a float to a string without rounding it - Stack ...

    Apr 1, 2015 · len(repr(float(x)/3)) However I must say that this isn't as reliable as you think. Floats are entered/displayed as decimal numbers, but your computer (in fact, your standard C library) …

  8. python - Changing strings to floats in an imported .csv - Stack …

    Aug 29, 2016 · csv.QUOTE_NONNUMERIC: Instructs the reader to convert all non-quoted fields to type float. That works if you're ok with all unquoted fields (integer, float, text, Boolean etc.) …

  9. python - Convert floating point number to a certain precision, and …

    Mar 7, 2013 · Python 3.6 (officially released in December of 2016), added the f string literal, see more information here, which extends the str.format method (use of curly braces such that …

  10. error handling - Confusing python - Cannot convert string to float ...

    The point here it can not convert alphanumeric strings, in some cases if you are scraping data or something like $400, $ symbol is alphanumeric then it consider an string, if you try convert to …

Refresh