eelbrain.Factor.count

Factor.count(value=None, start=-1)[source]

Cumulative count of the occurrences of value

Parameters:
  • value (str) – Value which is to be counted.

  • start (int) – Value at which to start counting (with the default of -1, the first occurrence will be 0).

Returns:

count – Cumulative count of value in self.

Return type:

Var of int, len = len(self)

Examples

>>> a = Factor('abcabcabccc')
>>> a
Factor(['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'c', 'c'])
>>> a.count()
array([0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4])
>>> a.count('a')
array([0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2])