rustat-python-api 0.5.8__py3-none-any.whl → 0.5.9__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.
- rustat_python_api/processing.py +17 -10
- {rustat_python_api-0.5.8.dist-info → rustat_python_api-0.5.9.dist-info}/METADATA +1 -1
- {rustat_python_api-0.5.8.dist-info → rustat_python_api-0.5.9.dist-info}/RECORD +6 -6
- {rustat_python_api-0.5.8.dist-info → rustat_python_api-0.5.9.dist-info}/LICENSE +0 -0
- {rustat_python_api-0.5.8.dist-info → rustat_python_api-0.5.9.dist-info}/WHEEL +0 -0
- {rustat_python_api-0.5.8.dist-info → rustat_python_api-0.5.9.dist-info}/top_level.txt +0 -0
rustat_python_api/processing.py
CHANGED
|
@@ -13,20 +13,27 @@ def process_list(x: pd.Series):
|
|
|
13
13
|
else:
|
|
14
14
|
return lst
|
|
15
15
|
|
|
16
|
+
def take_last(x: pd.Series):
|
|
17
|
+
lst = x.dropna().tolist()
|
|
18
|
+
if lst:
|
|
19
|
+
return lst[-1]
|
|
20
|
+
return np.nan
|
|
21
|
+
|
|
16
22
|
|
|
17
23
|
def gluing(df: pd.DataFrame) -> pd.DataFrame:
|
|
18
24
|
cols = ['player_id', 'half', 'second', 'pos_x', 'pos_y']
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
26
|
+
agg_rules = {}
|
|
27
|
+
|
|
28
|
+
for col_name in df.columns:
|
|
29
|
+
if col_name not in cols:
|
|
30
|
+
if col_name in ['action_name', 'action_id']:
|
|
31
|
+
agg_rules[col_name] = process_list
|
|
32
|
+
else:
|
|
33
|
+
agg_rules[col_name] = take_last
|
|
34
|
+
|
|
35
|
+
df_gb = df.groupby(cols).agg(agg_rules).reset_index()
|
|
36
|
+
|
|
30
37
|
df_gb['pos_dest_nan'] = (df_gb['pos_dest_x'].isna() & df_gb['pos_dest_y'].isna()).astype(int)
|
|
31
38
|
df_gb = df_gb.sort_values(by=['half', 'second', 'possession_number', 'pos_dest_nan']).reset_index(drop=True)
|
|
32
39
|
return df_gb
|
|
@@ -3,10 +3,10 @@ rustat_python_api/config.py,sha256=eMvi1p8Cfvnbp6Cd4bBOwgehVN7thKnaQV5uzWyGZXM,1
|
|
|
3
3
|
rustat_python_api/models_api.py,sha256=oHXEqeCupvZwjVEdoxf7W9LP7ELFKA8-9DuRXpQHLno,1701
|
|
4
4
|
rustat_python_api/parser.py,sha256=PrGvN3vY0oczMsJxyUxBO0Yb1P03Moc74AgGYHYr_X8,10216
|
|
5
5
|
rustat_python_api/pitch_control.py,sha256=c2uX7B3IMjdKFIb3QulO3188RfzgPwT4BdR8N1XYf_w,11643
|
|
6
|
-
rustat_python_api/processing.py,sha256=
|
|
6
|
+
rustat_python_api/processing.py,sha256=WES2D77uu3ScpjN0nW8ozatHteCZJQmmF9WpHPgGfJo,2835
|
|
7
7
|
rustat_python_api/urls.py,sha256=iJTD31T6OyXPAhmhViwFXVehrzwsOjBDONA1SIVc_40,1068
|
|
8
|
-
rustat_python_api-0.5.
|
|
9
|
-
rustat_python_api-0.5.
|
|
10
|
-
rustat_python_api-0.5.
|
|
11
|
-
rustat_python_api-0.5.
|
|
12
|
-
rustat_python_api-0.5.
|
|
8
|
+
rustat_python_api-0.5.9.dist-info/LICENSE,sha256=4Cohqg5p6Mq1xyrzdEX8AvFSA62GSVvapEOr2xK_tgY,57
|
|
9
|
+
rustat_python_api-0.5.9.dist-info/METADATA,sha256=Xwu5Q-R1tsAZ6r49Mii-LiCOtgWcirykl_EI_-0Oghw,1730
|
|
10
|
+
rustat_python_api-0.5.9.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
11
|
+
rustat_python_api-0.5.9.dist-info/top_level.txt,sha256=VK0hmkKZE9YThxolUcoE6JtGI67NFeKJMBLuet8kI4w,18
|
|
12
|
+
rustat_python_api-0.5.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|