psychopy_ext.stats.df_fromdict(data, repeat=1)[source]

Produces a factorial DataFrame from a dict or list of tuples.

For example, suppose you want to generate a DataFrame like this:

   a    b
0  one  0
1  one  1
2  two  0
3  two  1

This function generates such output simply by providing the following: df_fromdict([(‘a’, [‘one’, ‘two’]), (‘b’, [0, 1])])

data: dict or a list of tuples

Data used to produce a DataFrame. Keys specify column names, and values specify possible (unique) values.

repeat: int (default: 1)

How many times everything should be repeated. Useful if you want to simulate multiple samples of each condition, for example.


pandas.DataFrame with data.items() column names