The Real Python Podcast

Python Doesn't Round Numbers the Way You Might Think


Listen Later

Does Python round numbers the same way you learned back in math class? You might be surprised by the default method Python uses and the variety of ways to round numbers in Python. Christopher Trudeau is back on the show this week, bringing another batch of PyCoder’s Weekly articles and projects.

Christopher discusses his recent video course, “Rounding Numbers in Python.” He covers rounding bias and how to avoid introducing it into your dataset. We dig into the various rounding strategies and how to implement them in Python.

We also share several other articles and projects from the Python community, including a news roundup, a fast Python linter for error-free and maintainable code, the decline of the user interface, more thoughts on Python in Excel, a discussion about calendar versioning for Python, a financial database as a Python module, and a project to prettify the colors of your terminal user interfaces.

This episode is sponsored by Sentry.

Course Spotlight: Rounding Numbers in Python

In this video course, you’ll learn about the mistakes you might make when rounding numbers and how to best manage or avoid them. It’s a great place to start for the early to intermediate Python developer who’s interested in using Python for finance, data science, or scientific computing.

Topics:

  • 00:00:00 – Introduction
  • 00:02:06 – NumPy 2.0.0 Release Notes
  • 00:02:52 – Python 3.13.0 beta 3 released
  • 00:03:05 – Announcing the PSF Board Candidates for 2024!
  • 00:03:27 – Prohibiting Outlook Email Domains
  • 00:04:31 – Ruff: A Python Linter for Error-Free and Maintainable Code
  • 00:09:31 – Sponsor: Sentry
  • 00:10:35 – The Decline of the User Interface
  • 00:19:14 – My Thoughts on Python in Excel
  • 00:26:30 – Rounding Numbers in Python
  • 00:30:53 – Video Course Spotlight
  • 00:32:13 – PEP 2026: Calendar Versioning for Python
  • 00:42:37 – Financial Database as a Python Module
  • 00:45:34 – prettypretty: Build Awesome Terminal User Interfaces
  • 00:47:48 – Thanks and goodbye
  • News:

    • NumPy 2.0.0 Release Notes — NumPy v2.0 Manual – The long awaited 2.0 release of NumPy landed this week. Not all the docs are up to date yet, but this final draft of the release notes shows you what is included.
    • Python Insider: Python 3.13.0 beta 3 released
    • Python Software Foundation News: Announcing the PSF Board Candidates for 2024!
    • Prohibiting Outlook Email Domains – Due to an inordinate amount of bot accounts coming from outlook.com and hotmail.com, PyPI has disallowed new account sign-ups with email addresses from these domains.
    • Show Links:

      • Ruff: A Python Linter for Error-Free and Maintainable Code – Ruff is an extremely fast, modern linter with a simple interface, making it straightforward to use. It also aims to be a drop-in replacement for other linting and formatting tools, like Pylint, isort, and Black. It’s no surprise it’s quickly becoming one of the most popular Python linters.
      • The Decline of the User Interface – “Software has never looked cooler, but user interface design and user experience have taken a sharp turn for the worse.”
      • My Thoughts on Python in Excel – Microsoft’s new Python in Excel functionality was released almost a year ago. Having now had time to play with it, Felix gives his take.
      • Rounding Numbers in Python – In this video course, you’ll learn about the mistakes you might make when rounding numbers and how to best manage or avoid them. It’s a great place to start for the early to intermediate Python developer who’s interested in using Python for finance, data science, or scientific computing.
      • Discussion:

        • PEP 2026: Calendar Versioning for Python – This PEP proposes updating the versioning scheme for Python to include the calendar year. This aims to make the support lifecycle clear by making it easy to see when a version was first released, and easier to work out when it will reach end of life (EOL).
        • Associated discussion
        • Semantic Versioning 2.0.0 - Semantic Versioning
        • Calendar Versioning — CalVer
        • Projects:

          • FinanceDatabase: Financial Database as a Python Module
          • prettypretty: Build Awesome Terminal User Interfaces
          • Additional Links:

            • The Humane Interface - Wikipedia
            • Python Resources for working with Excel - Working with Excel Files in Python
            • Episode #186: Exploring Python in Excel – The Real Python Podcast
            • Cash rounding - Wikipedia
            • Level up your Python skills with our expert-led courses:

              • Python Basics: Numbers and Math
              • Rounding Numbers in Python
              • Editing Excel Spreadsheets in Python With openpyxl
              • Support the podcast & join our community of Pythonistas

                ...more
                View all episodesView all episodes
                Download on the App Store

                The Real Python PodcastBy Real Python

                • 4.7
                • 4.7
                • 4.7
                • 4.7
                • 4.7

                4.7

                134 ratings


                More shows like The Real Python Podcast

                View all
                Hanselminutes with Scott Hanselman by Scott Hanselman

                Hanselminutes with Scott Hanselman

                378 Listeners

                Software Engineering Radio - the podcast for professional software developers by se-radio@computer.org

                Software Engineering Radio - the podcast for professional software developers

                262 Listeners

                The Changelog: Software Development, Open Source by Changelog Media

                The Changelog: Software Development, Open Source

                285 Listeners

                LINUX Unplugged by Jupiter Broadcasting

                LINUX Unplugged

                263 Listeners

                Thoughtworks Technology Podcast by Thoughtworks

                Thoughtworks Technology Podcast

                43 Listeners

                Talk Python To Me by Michael Kennedy

                Talk Python To Me

                585 Listeners

                Software Engineering Daily by Software Engineering Daily

                Software Engineering Daily

                630 Listeners

                Super Data Science: ML & AI Podcast with Jon Krohn by Jon Krohn

                Super Data Science: ML & AI Podcast with Jon Krohn

                295 Listeners

                Python Bytes by Michael Kennedy and Brian Okken

                Python Bytes

                212 Listeners

                Data Engineering Podcast by Tobias Macey

                Data Engineering Podcast

                142 Listeners

                Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

                Syntax - Tasty Web Development Treats

                984 Listeners

                CoRecursive: Coding Stories by Adam Gordon Bell - Software Developer

                CoRecursive: Coding Stories

                185 Listeners

                DataFramed by DataCamp

                DataFramed

                267 Listeners

                Practical AI by Practical AI LLC

                Practical AI

                196 Listeners

                The Stack Overflow Podcast by The Stack Overflow Podcast

                The Stack Overflow Podcast

                63 Listeners