PFF FC
- class Event_data(data_provider='pff_fc', event_path=event_path, max_workers=max_workers).load_data()
Load and process PFF FC event data from a JSON file or folder.
- Parameters:
event_path – Path to the event JSON files/Folder.
max_workers (int, optional) – Maximum number of workers to use for parallel processing. Default is 1.
- Returns:
DataFrame containing processed event data.
- Return type:
pd.DataFrame
Example usage for single match:
import pandas as pd from preprocessing import Event_data event_path='path/to/event.json' pff_fc_df=Event_data(data_provider='pff_fc',event_path=event_path).load_data() print(pff_fc_df.head())
Example usage for multiple matches:
from preprocessing import Event_data event_folder='path/to/event/folder' pff_fc_df=Event_data(data_provider='pff_fc', event_path=event_folder, max_workers=10).load_data() print(pff_fc_df.head())
Details:
This function reads PFF FC event data from a JSON file and converts it into a DataFrame.
Retrieves all event and tracking files from the input directories.
Converts PFF-style event data to Metrica format.
The returned DataFrame contains the following columns:
match_id: Identifier for the match where the event occurred.Team: Team associated with the event (‘Home’ or ‘Away’)Type: Type of the eventSubtype: Subtype of the event (e.g., ‘success’ or ‘fail’)Period: Period of the match (1 or 2)Start Frame: Frame index at event startStart Time [s]: Time in seconds at event startEnd Frame: Frame index at event endEnd Time [s]: Time in seconds at event endFrom: Player performing the actionTo: Player receiving the action (if applicable)Start X: Starting x-coordinate of the eventStart Y: Starting y-coordinate of the eventEnd X: Ending x-coordinate of the eventEnd Y: Ending y-coordinate of the event