def apply(self, func, axis=<NUM_LIT:0>, broadcast=None, reduce=None,<EOL>result_type=None):
if not len(self.columns):<EOL><INDENT>return self<EOL><DEDENT>axis = self._get_axis_number(axis)<EOL>if isinstance(func, np.ufunc):<EOL><INDENT>new_series = {}<EOL>for k, v in self.items():<EOL><INDENT>applied = func(v)<EOL>applied.fill_value = func(v.fill_value)<EOL>new_series[k] = applied<EOL><DEDENT>return self._constructor(<EOL>new_series, index=self.index, columns=self.columns,<EOL>default_fill_value=self._default_fill_value,<EOL>default_kind=self._default_kind).__finalize__(self)<EOL><DEDENT>from pandas.core.apply import frame_apply<EOL>op = frame_apply(self,<EOL>func=func,<EOL>axis=axis,<EOL>reduce=reduce,<EOL>broadcast=broadcast,<EOL>result_type=result_type)<EOL>return op.get_result()<EOL>
Analogous to DataFrame.apply, for SparseDataFrame

Parameters
----------
func : function
    Function to apply to each column
axis : {0, 1, 'index', 'columns'}
broadcast : bool, default False
    For aggregation functions, return object of same size with values
    propagated

    .. deprecated:: 0.23.0
       This argument will be removed in a future version, replaced
       by result_type='broadcast'.

reduce : boolean or None, default None
    Try to apply reduction procedures. If the DataFrame is empty,
    apply will use reduce to determine whether the result should be a
    Series or a DataFrame. If reduce is None (the default), apply's
    return value will be guessed by calling func an empty Series (note:
    while guessing, exceptions raised by func will be ignored). If
    reduce is True a Series will always be returned, and if False a
    DataFrame will always be returned.

    .. deprecated:: 0.23.0
       This argument will be removed in a future version, replaced
       by result_type='reduce'.

result_type : {'expand', 'reduce', 'broadcast, None}
    These only act when axis=1 {columns}:

    * 'expand' : list-like results will be turned into columns.
    * 'reduce' : return a Series if possible rather than expanding
      list-like results. This is the opposite to 'expand'.
    * 'broadcast' : results will be broadcast to the original shape
      of the frame, the original index & columns will be retained.

    The default behaviour (None) depends on the return value of the
    applied function: list-like results will be returned as a Series
    of those. However if the apply function returns a Series these
    are expanded to columns.

    .. versionadded:: 0.23.0

Returns
-------
applied : Series or SparseDataFrame