About 76,700 results
Open links in new tab
  1. Why does Python 3 round half to even? - Stack Overflow

    I was just re-reading What’s New In Python 3.0 and it states: The round() function rounding strategy and return type have changed. Exact halfway cases are now rounded to the nearest …

  2. python - How do you round UP a number? - Stack Overflow

    May 5, 2017 · How does one round a number UP in Python? I tried round (number) but it rounds the number down. Here is an example: round (2.3) = 2.0 and not 3, as I would like. Then I tried …

  3. How to round to 2 decimals with Python? [duplicate]

    Dec 9, 2013 · How to round to 2 decimals with Python? [duplicate] Asked 11 years, 11 months ago Modified 1 year, 7 months ago Viewed 2.3m times

  4. round() doesn't seem to be rounding properly - Stack Overflow

    The documentation for the round() function states that you pass it a number, and the positions past the decimal to round. Thus it should do this: n = 5.59 round(n, 1) # 5.6 But, in actuality, …

  5. How to properly round-up half float numbers? - Stack Overflow

    @simomo Python's round() function used to round up in older versions, but they switched the rounding strategy to half to even in Python 3. It was a deliberate choice because this produces …

  6. python - Round number to nearest integer - Stack Overflow

    round(x) will round it and change it to integer. You are not assigning round(h) to any variable. When you call round(h), it returns the integer number but does nothing else; you have to …

  7. python - How to round a floating point number up to a certain …

    Jan 22, 2015 · Here, num is the decimal number. x is the decimal up to where you want to round a floating number. The advantage over other implementation is that it can fill zeros at the right …

  8. python - Simple way to round floats when printing - Stack Overflow

    Apr 23, 2015 · Simple way to round floats when printing Asked 10 years, 7 months ago Modified 8 years, 11 months ago Viewed 16k times

  9. python - round a single column in pandas - Stack Overflow

    Oct 1, 2014 · 92 .round () is a pandas method and it applies to the output format rather than the underlying value. If you have floats with many decimal places you can instead apply the …

  10. Rounding a number in Python but keeping ending zeros

    However, I need the number to round to two decimal places even if there would be a trailing zero, so 2606.89579999999 should become 260690. I currently have it so i takes the data from the …