pokerdf 1.0.2__py3-none-any.whl → 1.0.4__py3-none-any.whl

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.
@@ -53,46 +53,45 @@ def compose_dataframe() -> pd.DataFrame:
53
53
  """
54
54
  # Compose default dataframe
55
55
  df = pd.DataFrame(
56
- columns=[
57
- "Modality",
58
- "TableSize",
59
- "BuyIn",
60
- "TournID",
61
- "TableID",
62
- "HandID",
63
- "LocalTime",
64
- "Level",
65
- "Ante",
66
- "Blinds",
67
- "Owner",
68
- "OwnersHand",
69
- "Playing",
70
- "Player",
71
- "Seat",
72
- "PostedAnte",
73
- "Position",
74
- "PostedBlind",
75
- "Stack",
76
- "PreflopAction",
77
- "FlopAction",
78
- "TurnAction",
79
- "RiverAction",
80
- "AnteAllIn",
81
- "PreflopAllIn",
82
- "FlopAllIn",
83
- "TurnAllIn",
84
- "RiverAllIn",
85
- "BoardFlop",
86
- "BoardTurn",
87
- "BoardRiver",
88
- "ShowDown",
89
- "CardCombination",
90
- "Result",
91
- "Balance",
92
- "FinalRank",
93
- "Prize",
94
- ],
95
- data=None,
56
+ {
57
+ "Modality": pd.Series(dtype="object"),
58
+ "TableSize": pd.Series(dtype="int64"),
59
+ "BuyIn": pd.Series(dtype="object"),
60
+ "TournID": pd.Series(dtype="object"),
61
+ "TableID": pd.Series(dtype="object"),
62
+ "HandID": pd.Series(dtype="object"),
63
+ "LocalTime": pd.Series(dtype="datetime64[ns]"),
64
+ "Level": pd.Series(dtype="object"),
65
+ "Ante": pd.Series(dtype="float64"),
66
+ "Blinds": pd.Series(dtype="object"),
67
+ "Owner": pd.Series(dtype="object"),
68
+ "OwnersHand": pd.Series(dtype="object"),
69
+ "Playing": pd.Series(dtype="int64"),
70
+ "Player": pd.Series(dtype="object"),
71
+ "Seat": pd.Series(dtype="int64"),
72
+ "PostedAnte": pd.Series(dtype="float64"),
73
+ "Position": pd.Series(dtype="object"),
74
+ "PostedBlind": pd.Series(dtype="float64"),
75
+ "Stack": pd.Series(dtype="float64"),
76
+ "PreflopAction": pd.Series(dtype="object"),
77
+ "FlopAction": pd.Series(dtype="object"),
78
+ "TurnAction": pd.Series(dtype="object"),
79
+ "RiverAction": pd.Series(dtype="object"),
80
+ "AnteAllIn": pd.Series(dtype="bool"),
81
+ "PreflopAllIn": pd.Series(dtype="bool"),
82
+ "FlopAllIn": pd.Series(dtype="bool"),
83
+ "TurnAllIn": pd.Series(dtype="bool"),
84
+ "RiverAllIn": pd.Series(dtype="bool"),
85
+ "BoardFlop": pd.Series(dtype="object"),
86
+ "BoardTurn": pd.Series(dtype="object"),
87
+ "BoardRiver": pd.Series(dtype="object"),
88
+ "ShowDown": pd.Series(dtype="object"),
89
+ "CardCombination": pd.Series(dtype="object"),
90
+ "Result": pd.Series(dtype="object"),
91
+ "Balance": pd.Series(dtype="float64"),
92
+ "FinalRank": pd.Series(dtype="int64"),
93
+ "Prize": pd.Series(dtype="float64"),
94
+ }
96
95
  )
97
96
  return df
98
97
 
@@ -4,7 +4,7 @@ from pokerdf.regex.regex_patterns import RegexPatterns
4
4
  r = RegexPatterns()
5
5
 
6
6
 
7
- def capture_common_data(hand: list[str]) -> dict[str, Any]:
7
+ def capture_common_data(splitted_hand: list[str]) -> dict[str, Any]:
8
8
  """
9
9
  Captures the common data of the tournament
10
10
 
@@ -15,11 +15,11 @@ def capture_common_data(hand: list[str]) -> dict[str, Any]:
15
15
  dict: Dictionary of captured values.
16
16
  """
17
17
  row: dict[str, Any] = {}
18
- row["Modality"] = r.get_modality(hand)
19
- row["TableSize"] = r.get_table_size(hand)
20
- row["BuyIn"] = r.get_buyin(hand)
21
- row["TournID"] = r.get_tourn_id(hand)
22
- row["Owner"] = r.get_owner(hand)
18
+ row["Modality"] = r.get_modality(splitted_hand)
19
+ row["TableSize"] = r.get_table_size(splitted_hand)
20
+ row["BuyIn"] = r.get_buyin(splitted_hand)
21
+ row["TournID"] = r.get_tourn_id(splitted_hand)
22
+ row["Owner"] = r.get_owner(splitted_hand)
23
23
 
24
24
  return row
25
25
 
@@ -793,16 +793,13 @@ class RegexPatterns:
793
793
  if hand != []:
794
794
 
795
795
  # Pattern to extract
796
- regex = rf"{player} .* (?:and receives|and received) (\S+)"
796
+ regex = rf"{player} .* (?:and receives|and received) (?:[$€£]?)\s*(\d+(?:\.\d+)?)"
797
797
 
798
798
  # Get the first SHOW_DOWN content of a played hand
799
799
  target = hand[0]
800
800
 
801
801
  # Apply regex
802
- result_of_regex = re.findall(regex, target)
803
-
804
- # Normalize
805
- final_result = [float(x) for x in result_of_regex if str(x).isdigit()]
802
+ final_result = re.findall(regex, target)[:1]
806
803
 
807
804
  # Normalize output
808
805
  if final_result == []:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pokerdf
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: Converts poker hand history files to pandas DataFrames.
5
5
  Author: Murilo Amaral
6
6
  Author-email: murilogmamaral@gmail.com
@@ -72,8 +72,13 @@ Seat 3: VillainB (big blind) collected (40)
72
72
  | 1 | USD Hold'em No Limit | 3 | $1.84+$0.16 | 3026510091 | 1 | 219372022626 | 2020-10-14 10:33:59 | I | None | [10.0, 20.0] | garciamurilo | ['6h', 'Ks'] | 3 | garciamurilo | 2 | None | small blind | 10 | 500 | ['calls', '10'] | ['checks', ''] | ['checks', ''], ['folds', ''] | ['', ''] | False | False | False | False | False | ['4d', 'Qs', 'Qd'] | ['4d', 'Qs', 'Qd', '3s'] | [] | [None, None] | None | folded | nan | -1 | None |
73
73
  | 2 | USD Hold'em No Limit | 3 | $1.84+$0.16 | 3026510091 | 1 | 219372022626 | 2020-10-14 10:33:59 | I | None | [10.0, 20.0] | garciamurilo | ['6h', 'Ks'] | 3 | VillainB | 3 | None | big blind | 20 | 500 | ['checks', ''] | ['checks', ''] | ['bets', '20'] | ['', ''] | False | False | False | False | False | ['4d', 'Qs', 'Qd'] | ['4d', 'Qs', 'Qd', '3s'] | [] | [None, None] | None | non-sd win | 40 | -1 | None |
74
74
 
75
+ <br>
76
+
75
77
  #### Data Modeling
76
- For advanced analytics, you will need to transform the data and explore different data models. The final structure of your data may vary depending on the specific goals of your project.
78
+ For advanced analytics, you will need to transform the data generated with the package and explore different data models. The final structure of your data may vary depending on the specific goals of your project. You will find below a suggestion of relational data model split into five tables that may be useful for most cases.
79
+ <br>
80
+
81
+ ![pokerdm](https://github.com/user-attachments/assets/8936f540-51c7-4a1d-a5b1-bc9fc73c4313)
77
82
 
78
83
 
79
84
  ## Installation
@@ -0,0 +1,12 @@
1
+ pokerdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pokerdf/core/read_and_convert.py,sha256=52bfqszQ2STXBh4EFLyw8spieYm7Zus5iTdraHdVVC8,8029
3
+ pokerdf/main.py,sha256=wZNxv8Os29FErPSqwtW4EL6W9g7Hrs-3YrLNOUBfwUU,2609
4
+ pokerdf/regex/regex_execution.py,sha256=I5nbCiC-ulnf6ehh55hiSwdGwKGdmOwVEj5b348hzs0,3387
5
+ pokerdf/regex/regex_patterns.py,sha256=mYtLVx6IholDeygTeaIf8FEGwLgzOnBB8hCLhGvD1zY,22722
6
+ pokerdf/utils/strings.py,sha256=M67LK8HDsCRJbMosSpldAhkh7dJbvFm3P_cwCJJwABo,24
7
+ pokerdf/validation/pydantic_modules.py,sha256=sta6I4kOSpVVp1ztMds-6um6GKzHjmKJMdWWjVgi2vs,1302
8
+ pokerdf-1.0.4.dist-info/LICENSE,sha256=cwU1q-Z805EbGDpnov1ZMvOm_1FN9GHLUymwEy7poHM,1070
9
+ pokerdf-1.0.4.dist-info/METADATA,sha256=N_IxhMkLStEamVpIglUJj6io9-tpMUO95Tbblyjq-R0,13246
10
+ pokerdf-1.0.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
+ pokerdf-1.0.4.dist-info/entry_points.txt,sha256=Ut_cKkG47Nvu8xyWDuDLPo7qry4Wye_te9Y3LqWNwA8,45
12
+ pokerdf-1.0.4.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- pokerdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- pokerdf/core/read_and_convert.py,sha256=RKrc4T2wdqOnsu_A1FkZsVQj4sQ_A3T3nbmksdYqexY,7058
3
- pokerdf/main.py,sha256=wZNxv8Os29FErPSqwtW4EL6W9g7Hrs-3YrLNOUBfwUU,2609
4
- pokerdf/regex/regex_execution.py,sha256=Z7rAJAk_VaeamJ6O-i_WqqSN7E2Bvds6zNKDqf9PWgk,3333
5
- pokerdf/regex/regex_patterns.py,sha256=9UV7K-ojFgUkmbdfBTmfYi_-qKT6OsSO4W5Btcy4gTc,22803
6
- pokerdf/utils/strings.py,sha256=M67LK8HDsCRJbMosSpldAhkh7dJbvFm3P_cwCJJwABo,24
7
- pokerdf/validation/pydantic_modules.py,sha256=sta6I4kOSpVVp1ztMds-6um6GKzHjmKJMdWWjVgi2vs,1302
8
- pokerdf-1.0.2.dist-info/LICENSE,sha256=cwU1q-Z805EbGDpnov1ZMvOm_1FN9GHLUymwEy7poHM,1070
9
- pokerdf-1.0.2.dist-info/METADATA,sha256=7BgzE7Jw3kNhOUyCH26cl1YO4UlWcKTM-19zWFYboGo,12997
10
- pokerdf-1.0.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
- pokerdf-1.0.2.dist-info/entry_points.txt,sha256=Ut_cKkG47Nvu8xyWDuDLPo7qry4Wye_te9Y3LqWNwA8,45
12
- pokerdf-1.0.2.dist-info/RECORD,,