Member-only story

Easiest Way to Convert Betting Odds into any format using Python

The Scraper Guy
2 min readJan 13, 2024

--

Hope everyone is doing well, today we will discuss how to convert Betting odds between each format, Fractional, Decimal, American and probabilities simply using python. This can be very useful for when we are scraping betting sites and transforming our odds data.

We will use the Python package pybettor, a link to which can be found here

Firstly install the package using pip install pybettor.

Next we can explore some of the functionality this package provides.

from pybettor import convert_odds, implied_odds
implied_odds(0.75, category="all")

The above function simply takes an implied probability and outputs that probability in all of the odds formats.

Next, we can convert between any odds formats using the following function simply change the odds in the second and third strings depending on what you want.

convert_odds(1.833, "dec","frac")

--

--

The Scraper Guy
The Scraper Guy

Written by The Scraper Guy

Teaching You How to Scrape Using Python LinkTree - https://linktr.ee/scrapingguy

No responses yet