statsbomb / statsbombpy

Easily stream StatsBomb data into Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a way to identify the player in a 360 frame?

wwwidonja opened this issue · comments

Contact Details

wwwidonja@gmail.com

Version

1.0.1

What platform are you seeing the problem on?

Windows

What Python version are you running, are you using a virtual environment? Give us as much info as you can.

3.8

What happened?

I'm interested if there is a way to identify which player (name, id...) corresponds to an actor, present in a 360 dataframe (in the open data) and - if not - am curious if anyone has attempted to identify them.

Cheers and kind regards,
Vid Stropnik

Relevant log output

No response

Code to reproduce issue

No response

Attempted solutions

No response

That information is available in the event data for the match you're interested in, so it's a case of joining the relevant output of sb.events() to the output of sb.frames() on event uuid, e.g.

import pandas as pd
from statsbombpy import sb

events = sb.events(match_id=3788741)
frames = sb.frames(match_id=3788741)

player_info = events[["id", "player", "player_id"]].rename(
    columns={"player": "actor_name", "player_id": "actor_id"}
)

frames = pd.merge(player_info, frames, on="id", how="left")

Thank you for your response. However, I believe that the answer above only answers the question of which player is the actor: ie the on ball player at a given snapshot.

I was interested if it was possible to identify each individual player, corresponding to a row in the frames dataframe.

Kind regards,
Vid S

No. We don't collect the identities of other players at present (apart from the goalkeeper when they are visible). The only public work I know of that attempts to infer player IDs in 360 data without using additional data sources is this, but it won't be totally accurate.