Skip to content

Fix pandas 3.0 to_dict() positional arguments in pm4py/util/pandas_utils.py #567

Description

@jyf593

Summary

pm4py/util/pandas_utils.py uses positional arguments to DataFrame.to_dict(), which pandas has deprecated in favor of the orient= keyword.

Deprecation context

Deprecated allowing non-keyword arguments in DataFrame.to_dict().


Occurrence 1 — to_dict_records() (~line 60)

Link: https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/util/pandas_utils.py#L60

Before:

return df.to_dict("records")

After (suggested):

return df.to_dict(orient="records")

Occurrence 2 — to_dict_index() (~line 83)

Link: https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/util/pandas_utils.py#L83

Before:

return df.to_dict("index")

After (suggested):

return df.to_dict(orient="index")

Both changes are behavior-preserving forward-compat fixes for pandas 3.x. Happy to open a PR if preferred.

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