Skip to content

Make to_dataframe handle more complex variables #111

@mbbruch

Description

@mbbruch

The to_dataframe method currently handles lists, dictionaries, and scalar variables. Ideally, a similar approach could convert more complex vector-style variables such as path_tpc, grades, curves, etc.

As an example, path_tpc entails a list of LinkPoint objects, each of which has a LinkIdx object, each of which has an idx variable.

Currently, retrieving a path_tpc requires something like this:

points = []
for i in range(len(train_sim.path_tpc.link_points)):
     points.append(train_sim.path_tpc.link_points[i].link_idx.idx)
     dataframes.append(
          pl.DataFrame({"link_idx":points})
               .with_row_index("step"))
     )`

Ideally, the following:

train_sim.to_dataframe(key_substrings_to_keep=["path_tpc.link_points(.*)link_idx"])

would return a "long-format" dataframe. (Currently, each link_idx.idx will appear as a separate column in a single-row dataframe).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions