Skip to content

On newer versions of pandas, the DIW dataloader fails to pivot_table #9

@bgpierc

Description

@bgpierc

On older pandas versions, pivot_table would skip non-numeric columns; this behavior was removed in newer versions. Instead, agg functions must be specified manually.

This concerns the DIW dataloader in graphfoundationmodels.dataloaders.dataloader_DIW.DIWDataset

# throws an error on newer pandas versions
df_pivot = df.pivot_table(index='Timestep', columns='node_id', values=all_cols)

A fix will specify a proper aggregation function like so:

agg_funcs = {col: 'mean' for col in all_cols}  # 'mean' can be changed as required

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions