Skip to content

to_pandas() -> to_df() adding additional columns functionality lost #202

@DriesDeprest

Description

@DriesDeprest

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions