In the to_pandas() method of our EventDataset class, we have an additional_columns argument which allows us to add extra columns using e.g. the following approach:
events_dataset.to_pandas(
additional_columns={"opponent_team_id": lambda event: int(
sp_dataset.metadata.teams[1].team_id
if event.team == sp_dataset.metadata.teams[0]
else sp_dataset.metadata.teams[0].team_id
),
"home_team_id": lambda event: int(sp_dataset.metadata.teams[0].team_id),
"away_team_id": lambda event: int(sp_dataset.metadata.teams[1].team_id),
},
)
However, with the to_pandas() method being deprecated, I wanted to start replacing them to the to_df() method. However, this method does not seem to offer the same functionality to add additional_columns.
How should we go about this?