The utils Module

add_zero_padding Convert input values to strings and add a zero-padding.
get_max_from_list Return the maximum value from a list or a list of lists.

Some functions that come in handy when working with psychophysics datasets.

pphelper.utils.add_zero_padding(data, length=3, return_series=True)

Convert input values to strings and add a zero-padding.

Parameters:
  • data (array_like) – The data to process.
  • length (int, optional) – The desired length of the padded output values.
  • return_series (bool, optional) – If True, return a pandas Series object. If false, return a numpy array.
Returns:

result – The padded input vector. All strings are created as unicode literals.

Return type:

Series or ndarray

Notes

If length is less than the length of one of the elements, these elements will be converted to strings only and returned. They will obviously not be zero-padded, but they will also not be truncated.

pphelper.utils.get_max_from_list(x)

Return the maximum value from a list or a list of lists.

Parameters:x (list) – A list or a list of lists.
Returns:The maximum value.
Return type:float
pphelper.utils.join_multi_level_index(index, sep=u'_')
Parameters:
  • index (MultiIndex) – The index to join.
  • sep (string, optional) – The separator to insert between the joined index. Defaults to an underscore (_).
Returns:

Return type:

The joined index.