spd.profit(stakes, odds, odds_type)
Calculates the profit from a bet or a Series of bets. Profit = Payout − Stake.
Parameters:
stakes(float,int, orpandas.Series): Scalar or Series of stake/bet values.odds(float,int, orpandas.Series): Scalar or Series of odds inodds_typeformat. Must match the type ofstakes(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: Profit of the bet, orpandas.Series: Series of profit values with the same length asstakesandodds.
Example (scalar):
import stakepd as spd
stakes = 100
odds = 2
profit = spd.profit(stakes, odds, 'decimal')
print(profit)
100
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])
profits = spd.profit(stakes, odds, 'decimal')
print(profits)
0 100.0
1 100.0
2 5.0
dtype: float64