Introduction
Odds ratios from a logistic regression, or betting odds from a market, are hard to
reason about directly — what does an odds ratio of 2.1 actually mean for the chance
something happens? ConvertOddsToProbability answers "what is the actual probability
implied by this odds value?" using the standard p = odds / (1 + odds) conversion,
turning a column of odds into a column of probabilities anyone can interpret. Reach for
it whenever you need to communicate model output or market-implied likelihoods to a
non-technical audience.
The function is particularly useful for:
- Interpreting logistic regression output (converting odds ratios to probabilities)
- Implied probability analysis in sports betting and financial markets
- Risk assessment and epidemiological studies
- Bayesian statistics and likelihood ratios
- Data normalization for machine learning models
- Communicating statistical risk to non-technical stakeholders
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
dataframerequired | | — | A pandas DataFrame containing a column with odds values. |
odds_columnrequired | | — | The name of the column in the DataFrame that contains the odds values. Odds should be numeric (int or float). |
probability_column_name | | None | The name for the new column that will contain the calculated probabilities. If None, the column will be named '{odds_column} - as probability'. |
Returns
The input DataFrame with an additional column containing the calculated probabilities (0 to 1). The original odds column is preserved.
Example
from analysistoolbox.data_processing import ConvertOddsToProbability
import pandas as pd
# Convert simple betting odds to implied probabilities
betting_odds = pd.DataFrame({
'outcome': ['Team A', 'Team B', 'Draw'],
'odds': [1.5, 4.0, 2.0]
})
betting_odds = ConvertOddsToProbability(betting_odds, 'odds')
# Adds 'odds - as probability' column: [0.6, 0.8, 0.667]