↓ Skip to main content
All methods

pandas.DataFrame.odds

DataFrame method → DataFrame
Signature
DataFrame.odds(odds_type: str = 'decimal')

Convert a DataFrame of implied probabilities to the specified odds type.

Each column is converted separately, and the output columns are named <column>_<odds_type>_odds.

Parameters

odds_type:{'decimal', 'fractional', 'american'}, default 'decimal'
Format of the odds to return.

Returns

pandas.DataFrame
Odds in odds_type format, with the same index as the input.

See also

pandas.Series.odds
Convert a Series of implied probabilities to the specified odds type.
pandas.DataFrame.implied_probability
The reverse: odds to implied probabilities.

Examples
#

import pandas as pd
import stakepd as spd   # importing stakepd adds these methods to pandas objects

Example:

implied_probabilities = pd.DataFrame({"A": [0.5, 0.4], "B": [0.3, 0.2]})
odds_df = implied_probabilities.odds(odds_type = "decimal")
print(odds_df)
Output:
   A_decimal_odds  B_decimal_odds
0             2.0        3.333333
1             2.5        5.000000

This method is also covered, alongside the rest of the module, in the overview guide.