def categorize(action, funcs=_funcs):
 action = action.strip('" ')
 res = set()
 for (category, f) in funcs:
  if f(action):
   res.add(category)
 if (not res):
  return ('other',)
 return tuple(res)

def categorize ( action , funcs = _funcs ) : action = action . strip ( '" ' ) res = set ( ) for ( category , f ) in funcs : if f ( action ) : res . add ( category ) if ( not res ) : return ( 'other' , ) return tuple ( res )
convert columns of the dataframe to category dtype .