macpie.pandas.count_trailers#

macpie.pandas.count_trailers(ser: Series, predicates=None, count_na=True, count_empty_string=True)#

Counts trailing elements in a pandas.Series object for which each predicate in predicates returns True.

Parameters:
serSeries
predicatessingle callable or list of callables, optional

If this returns True for a trailing element, that element will be counted.

count_nabool, default True

Whether to also count trailing elements that evaluate to True using pandas.isna()

count_empty_stringbool, default True

Whether to also count trailing elements that are empty strings ''

Returns:
int

A count of trailing elements that match the predicate.

Raises:
ValueError

If remove_na is False and remove_empty_string is False and predicates is not specified.