↓ Skip to main content

stakepd.payout

138 words·1 min
spd.payout(stakes, odds, odds_type)

Calculates the payout from a bet or a Series of bets.

Parameters:

  • stakes (float, int, or pandas.Series): Scalar or Series of stake/bet values.
  • odds (float, int, or pandas.Series): Scalar or Series of odds in odds_type format. Must match the type of stakes (scalar or Series of the same length).
  • odds_type (str): Type of odds provided. Supported values are 'decimal', 'fractional', 'american', and 'implied_probability'.

Returns:

  • float: Payout of the bet, or
  • pandas.Series: Series of payouts with the same length as stakes and odds.

Example (scalar):

import stakepd as spd

stakes = 100
odds = 2
payout = spd.payout(stakes, odds, 'decimal')
print(payout)
200

Example (Series):

import pandas as pd
import stakepd as spd

stakes = pd.Series([100, 50, 10])
odds = pd.Series([2.0, 3.0, 1.5])
payouts = spd.payout(stakes, odds, 'decimal')
print(payouts)
0    200.0
1    150.0
2     15.0
dtype: float64