Applies Python functions to rows or columns of a pandas dataframe, which may or may not result in aggregation.