↓ Skip to main content
All methods

pandas.Series.convert

Series method → Series
Signature
Series.convert(from_type, to_type)

Convert a Series between odds types, or between odds and implied probability.

Parameters

from_type:{'decimal', 'fractional', 'american', 'implied_probability'}
Format of the values in the Series.
to_type:{'decimal', 'fractional', 'american', 'implied_probability'}
Format to convert to.

Returns

pandas.Series
Odds or implied probabilities as float values in to_type format.

See also

pandas.DataFrame.convert
Convert a DataFrame between odds types, or between odds and implied probability.
pandas.Series.implied_probability
Calculate the implied probability from a Series of odds.
pandas.Series.odds
Convert a Series of implied probabilities to the specified odds type.

Examples
#

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

Decimal to American:

decimal_odds = pd.Series([2.0, 1.5, 3.0])
american_odds = decimal_odds.convert(from_type = 'decimal', to_type = 'american')
print(american_odds)
Output:
0     100.0
1    -200.0
2     200.0
dtype: float64

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