psifr.fr.reset_list#

psifr.fr.reset_list(df)#

Reset list index in a DataFrame.

Parameters:

df (pandas.DataFrame) – Raw or merged data. Must have subject and list fields.

Returns:

Data with a renumbered list field, starting from 1.

Return type:

pandas.DataFrame

Examples

>>> from psifr import fr
>>> subjects_list = [1, 1]
>>> study_lists = [['a', 'b'], ['c', 'd']]
>>> recall_lists = [['b'], ['c', 'd']]
>>> list_nos = [3, 4]
>>> raw = fr.table_from_lists(subjects_list, study_lists, recall_lists, lists=list_nos)
>>> raw
   subject  list trial_type  position item
0        1     3      study         1    a
1        1     3      study         2    b
2        1     3     recall         1    b
3        1     4      study         1    c
4        1     4      study         2    d
5        1     4     recall         1    c
6        1     4     recall         2    d
>>> fr.reset_list(raw)
   subject  list trial_type  position item
0        1     1      study         1    a
1        1     1      study         2    b
2        1     1     recall         1    b
3        1     2      study         1    c
4        1     2      study         2    d
5        1     2     recall         1    c
6        1     2     recall         2    d