File size: 1,130 Bytes
d6ea71e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""Configuration of the Atomic-SPADL language.



Attributes

----------

field_length : float

    The length of a pitch (in meters).

field_width : float

    The width of a pitch (in meters).

bodyparts : list(str)

    The bodyparts used in the Atomic-SPADL language.

actiontypes : list(str)

    The action types used in the Atomic-SPADL language.



"""

import pandas as pd

import socceraction.spadl.config as _spadl

field_length = _spadl.field_length
field_width = _spadl.field_width

bodyparts = _spadl.bodyparts
bodyparts_df = _spadl.bodyparts_df

actiontypes = _spadl.actiontypes + [
    "receival",
    "interception",
    "out",
    "offside",
    "goal",
    "owngoal",
    "yellow_card",
    "red_card",
    "corner",
    "freekick",
]


def actiontypes_df() -> pd.DataFrame:
    """Return a dataframe with the type id and type name of each Atomic-SPADL action type.



    Returns

    -------

    pd.DataFrame

        The 'type_id' and 'type_name' of each Atomic-SPADL action type.

    """
    return pd.DataFrame(list(enumerate(actiontypes)), columns=["type_id", "type_name"])