psweep.psweep.df_extract_params

psweep.psweep.df_extract_params#

psweep.psweep.df_extract_params(df, py_types=False)[source]#

Extract params (list of psets) from df.

Same as df_extract_dicts(), but limit columns to kind="pset" (see filter_cols()). This will reproduce the params fed to run() when following the prefix/postfix convention (see _get_col_filter()), meaning that the pset hashes will be the same.

Parameters:
Return type:

Sequence[dict]

Examples

>>> import psweep as ps
>>> from numpy.random import rand
>>> params=ps.pgrid(ps.plist("a", [1,2,3]), ps.plist("b", [77,88]))
>>> params
[{'a': 1, 'b': 77},
 {'a': 1, 'b': 88},
 {'a': 2, 'b': 77},
 {'a': 2, 'b': 88},
 {'a': 3, 'b': 77},
 {'a': 3, 'b': 88}]
>>> df=ps.run(func=lambda pset: dict(result_=rand()), params=params, save=False)
>>> ps.df_extract_params(df)
[{'a': 1, 'b': 77},
 {'a': 1, 'b': 88},
 {'a': 2, 'b': 77},
 {'a': 2, 'b': 88},
 {'a': 3, 'b': 77},
 {'a': 3, 'b': 88}]