Represent the project as a table

To aid in visualization and comparison, lazyscribe has a built-in method lazyscribe.Project.to_tabular() for generating a pandas-ready format:

from lazyscribe import Project

project = Project(fpath=..., mode="r")

experiments, tests = project.to_tabular()

The experiments entry in the tuple is a list of dictionaries, with each dictionary representing a single experiment in the project. It will contain metadata as well as each metric value and parameters that aren’t dictionaries, tuples, or lists. The tests object refers to non-global metrics. Similarly, it will contain some experiment metadata along with the test-level metrics from the experiment.

To use these lists, convert them to pandas.DataFrame objects with multi-index column names:

import pandas as pd

exp_df = pd.DataFrame(experiments)
exp_df.columns = pd.MultiIndex.from_tuples(exp_df.columns)

test_df = pd.DataFrame(tests)
test_df.columns = pd.MultiIndex.from_tuples(test_df.columns)

You can also make a pandas.Series for an experiment or a test:

experiment = project.experiments[0]
exp_s = pd.Series(experiment.to_tabular())

test = experiment.tests[0]
test_s = pd.Series(test.to_tabular())