UFCData 0.7.1__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ufcdata-0.7.1 → ufcdata-0.7.2}/PKG-INFO +1 -1
- {ufcdata-0.7.1 → ufcdata-0.7.2}/README.md +3 -9
- {ufcdata-0.7.1 → ufcdata-0.7.2}/UFCData.egg-info/PKG-INFO +1 -1
- ufcdata-0.7.2/pyproject.toml +22 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/ufcdata/helper.py +5 -15
- ufcdata-0.7.1/pyproject.toml +0 -14
- {ufcdata-0.7.1 → ufcdata-0.7.2}/LICENSE.md +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/UFCData.egg-info/SOURCES.txt +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/UFCData.egg-info/dependency_links.txt +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/UFCData.egg-info/requires.txt +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/UFCData.egg-info/top_level.txt +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/setup.cfg +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/ufcdata/__init__.py +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/ufcdata/data.py +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/ufcdata/evaluation.py +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/ufcdata/fighter.py +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/ufcdata/ratings.py +0 -0
- {ufcdata-0.7.1 → ufcdata-0.7.2}/ufcdata/search.py +0 -0
|
@@ -322,16 +322,16 @@ jon_jones_current, jon_jones_past = ufc.get_fighter_statistic(
|
|
|
322
322
|
The function `convert_odds()` converts American betting odds from strings into integers or floating point numbers.
|
|
323
323
|
|
|
324
324
|
```python
|
|
325
|
-
convert_odds(odds
|
|
325
|
+
convert_odds(odds)
|
|
326
326
|
```
|
|
327
327
|
|
|
328
328
|
### Parameters
|
|
329
329
|
|
|
330
|
-
* `odds` — American betting odds as a string.
|
|
330
|
+
* `odds` — American betting odds as a string, integer, float or None.
|
|
331
331
|
|
|
332
332
|
### Returns
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
Returns a `float` representing the implied probability of the betting odds.
|
|
335
335
|
|
|
336
336
|
For positive American odds:
|
|
337
337
|
|
|
@@ -344,7 +344,6 @@ For negative American odds:
|
|
|
344
344
|
```text
|
|
345
345
|
Probability = -odds / (-odds + 100)
|
|
346
346
|
```
|
|
347
|
-
If probability=False, takes the string and converts it to an integer.
|
|
348
347
|
|
|
349
348
|
### Example
|
|
350
349
|
|
|
@@ -355,13 +354,8 @@ data = ufc.get_data()
|
|
|
355
354
|
|
|
356
355
|
fights_df = data["past_fights"].copy()
|
|
357
356
|
|
|
358
|
-
fights_df["Fighter 1 Odds"] = fights_df["Fighter 1 Odds"].apply(
|
|
359
|
-
ufc.convert_odds
|
|
360
|
-
)
|
|
361
|
-
|
|
362
357
|
fights_df["Fighter 1 Probability"] = fights_df["Fighter 1 Odds"].apply(
|
|
363
358
|
ufc.convert_odds,
|
|
364
|
-
probability=True
|
|
365
359
|
)
|
|
366
360
|
```
|
|
367
361
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=40.8.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "UFCData"
|
|
7
|
+
version = "0.7.2"
|
|
8
|
+
description = "Obtain UFC data and functions to manipulate it"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
"huggingface-hub",
|
|
13
|
+
"pandas",
|
|
14
|
+
"numpy",
|
|
15
|
+
"glicko2",
|
|
16
|
+
"rapidfuzz",
|
|
17
|
+
"matplotlib",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
include = ["ufcdata*"]
|
|
22
|
+
exclude = ["scraper*", "UFCData_backup*"]
|
|
@@ -2,9 +2,9 @@ import re
|
|
|
2
2
|
import pandas as pd
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
-
def convert_odds(odds
|
|
5
|
+
def convert_odds(odds):
|
|
6
6
|
"""
|
|
7
|
-
Convert American betting odds to
|
|
7
|
+
Convert American betting odds to implied probability.
|
|
8
8
|
|
|
9
9
|
Parameters
|
|
10
10
|
----------
|
|
@@ -12,23 +12,16 @@ def convert_odds(odds, probability=False):
|
|
|
12
12
|
American betting odds. The function extracts the first signed or
|
|
13
13
|
unsigned integer from the input. Missing values return None.
|
|
14
14
|
|
|
15
|
-
probability : bool, default=False
|
|
16
|
-
If False, return the extracted American odds as an integer.
|
|
17
|
-
If True, return the implied probability as a decimal.
|
|
18
|
-
|
|
19
15
|
Returns
|
|
20
16
|
-------
|
|
21
|
-
|
|
22
|
-
The
|
|
23
|
-
implied probability. Returns None for missing values.
|
|
17
|
+
float or None
|
|
18
|
+
The implied probability as a decimal. Returns None for missing values.
|
|
24
19
|
|
|
25
20
|
Examples
|
|
26
21
|
--------
|
|
27
22
|
>>> convert_odds("+120")
|
|
28
|
-
|
|
23
|
+
0.45454545454545453
|
|
29
24
|
>>> convert_odds("-400")
|
|
30
|
-
-400
|
|
31
|
-
>>> convert_odds("-400", probability=True)
|
|
32
25
|
0.8
|
|
33
26
|
"""
|
|
34
27
|
if pd.isna(odds):
|
|
@@ -36,9 +29,6 @@ def convert_odds(odds, probability=False):
|
|
|
36
29
|
|
|
37
30
|
odds = int(re.search(r'[+-]?\d+', str(odds)).group())
|
|
38
31
|
|
|
39
|
-
if not probability:
|
|
40
|
-
return odds
|
|
41
|
-
|
|
42
32
|
if odds < 0:
|
|
43
33
|
return -odds / (-odds + 100)
|
|
44
34
|
else:
|
ufcdata-0.7.1/pyproject.toml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "UFCData"
|
|
3
|
-
version = "0.7.1"
|
|
4
|
-
description = "Obtain UFC data and functions to manipulate it"
|
|
5
|
-
requires-python = ">=3.10"
|
|
6
|
-
|
|
7
|
-
dependencies = [
|
|
8
|
-
"huggingface-hub",
|
|
9
|
-
"pandas",
|
|
10
|
-
"numpy",
|
|
11
|
-
"glicko2",
|
|
12
|
-
"rapidfuzz",
|
|
13
|
-
"matplotlib",
|
|
14
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|