About 182,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. python - Convert float to string in positional format (without ...

    This leads to the question: what is the easiest and also well-performing way to print arbitrary floating point number in decimal format, having the same digits as in repr(n) (or str(n) on …

  3. Python - decimal places (putting floats into a string)

    Jun 15, 2012 · Here is the Python Doc Link, please consider: Since str.format() is quite new, a lot of Python code still uses the % operator. However, because this old style of formatting will …

  4. 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 …

  5. 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) …

  6. string - Typecasting in Python - Stack Overflow

    May 1, 2016 · The following types -- for the most part -- don't exist in Python in the first place. In Python, strings are converted to ints, longs or floats, because that's all there is. You're asking …

  7. python - How to display a float with two decimal places ... - Stack ...

    I have a function taking float arguments (generally integers or decimals with one significant digit), and I need to output the values in a string with two decimal places (5 → 5.00, 5.5 → 5.50, etc). …

  8. python: how to convert currency to decimal? - Stack Overflow

    Oct 8, 2010 · Assuming the string stored in the variable dollars was generated using python's locale module. A potentially cleaner way to convert it back to float (decimal) is to use the atof …

  9. python - pandas converting floats to strings without decimals

    Jul 22, 2016 · Python Pandas Convert String to int/float. 0. Convert string decimal numbers in column to float in a ...

  10. python convert float to string - Stack Overflow

    Mar 9, 2017 · You can use Series.astype method to convert float to int then to string, here I am using df to refer to the data frame you read in from csv and df.zip to refer to the zip column …

Refresh