macpie.pandas.remove_trailers#

macpie.pandas.remove_trailers(ser: Series, predicates=None, remove_na=True, remove_empty_string=True)#

Removes 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 removed.

remove_nabool, default True

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

remove_empty_stringbool, default True

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

Returns:
Series

A Series of the result.

Raises:
ValueError

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