Event Data API#
EventData#
databallpy.schemas.EventData
- class EventData(*args, provider: str = 'unspecified', **kwargs)[source]
Bases:
DataFrame- to_video_analysis_xml(*, output: str = 'string', team_id: int | str | list[int | str] | None = None, player_id: int | str | list[int | str] | None = None, min_minute: int | None = None, max_minute: int | None = None, databallpy_events: list[str] | None = None, original_events: list[str] | None = None, is_successful: bool | None = None, before_seconds: float = 3.0, after_seconds: float = 3.0, code_column: str = 'databallpy_event', tag_period_starts: bool = True, time_decimals: int = 2) str[source]
Export filtered events to XML compatible with SportsCode/Longomatch.
- Parameters:
output (str) – If
"string"(default), return the XML as a string. Otherwise, treat the value as a file path, write the XML there, and return the path as a string.team_id (scalar or list, optional) – Filter to specific team(s).
player_id (scalar or list, optional) – Filter to specific player(s).
min_minute (int, optional) – Include only events at or after this minute.
max_minute (int, optional) – Include only events at or before this minute.
databallpy_events (list[str], optional) – Filter to specific databallpy event types.
original_events (list[str], optional) – Filter to specific original event types.
is_successful (bool, optional) – Filter by success status.
before_seconds (float) – Seconds before the event to start the clip (default 3.0).
after_seconds (float) – Seconds after the event to end the clip (default 3.0).
code_column (str) – Column to use as the event code (default “databallpy_event”).
tag_period_starts (bool) – Whether to add period start markers (default True).
time_decimals (int) – Decimal places for time values (default 2).
- Returns:
Pretty-printed XML string when
output="string", otherwise the path to the written file.- Return type:
str
XML Export#
databallpy.events_to_xml
- events_to_xml(events: Dict[str, Event], *, time_decimals: int = 2) str[source]#
Convert a dict of events into a XML string.
Structure:
<?xml version="1.0" encoding="UTF-8"?> <SORT_INFO>...</SORT_INFO> <ALL_INSTANCES> <instance> <ID>...</ID> <start>...</start> <end>...</end> <code>...</code> <label> <group>...</group> <text>...</text> </label> ... </instance> ... </ALL_INSTANCES> <ROWS> <row> <code>...</code> <r>int</r> <g>int</g> <b>int</b> <sort_order>int</sort_order> </row> ... </ROWS> </file>
databallpy.Event
- class Event[source]
databallpy.LabelDict
- class LabelDict[source]