# Buggy code
def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
    # skip if we are mixed datelike and trying reduce across axes
    # GH6125
    if reduce and axis == 1 and self._is_mixed_type and self._is_datelike_mixed_type:
        reduce = False

    # try to reduce first (by default)
    # this only matters if the reduction in values is of different dtype
    # e.g. if we want to apply to a SparseFrame, then can't directly reduce
    if reduce:
        values = self.values

        # Create a dummy Series from an empty array
        index = self._get_axis(axis)
        empty_arr = np.empty(len(index), dtype=values.dtype)
        dummy = Series(empty_arr, index=self._get_axis(axis), dtype=values.dtype)

        try:
            labels = self._get_agg_axis(axis)
            result = lib.reduce(values, func, axis=axis, dummy=dummy, labels=labels)
            return Series(result, index=labels)
        except Exception:
            pass

    dtype = object if self._is_mixed_type else None
    if axis == 0:
        series_gen = (self._ixs(i, axis=1) for i in range(len(self.columns)))
        res_index = self.columns
        res_columns = self.index
    elif axis == 1:
        res_index = self.index
        res_columns = self.columns
        values = self.values
        series_gen = (
            Series.from_array(arr, index=res_columns, name=name, dtype=dtype)
            for i, (arr, name) in enumerate(zip(values, res_index))
        )
    else:  # pragma : no cover
        raise AssertionError("Axis must be 0 or 1, got %s" % str(axis))

    i = None
    keys = []
    results = {}
    if ignore_failures:
        successes = []
        for i, v in enumerate(series_gen):
            try:
                results[i] = func(v)
                keys.append(v.name)
                successes.append(i)
            except Exception:
                pass
        # so will work with MultiIndex
        if len(successes) < len(res_index):
            res_index = res_index.take(successes)
    else:
        try:
            for i, v in enumerate(series_gen):
                results[i] = func(v)
                keys.append(v.name)
        except Exception as e:
            if hasattr(e, "args"):
                # make sure i is defined
                if i is not None:
                    k = res_index[i]
                    e.args = e.args + ("occurred at index %s" % com.pprint_thing(k),)
            raise

    if len(results) > 0 and is_sequence(results[0]):
        if not isinstance(results[0], Series):
            index = res_columns
        else:
            index = None

        result = self._constructor(data=results, index=index)
        result.columns = res_index

        if axis == 1:
            result = result.T
        result = result._convert(datetime=True, timedelta=True, copy=False)

    else:
        result = Series(results)
        result.index = res_index

    return result


# Traceback (TypeError)
In [29]: df = pd.DataFrame({'dt': pd.date_range("2015-01-01", periods=3, tz='Europe/Brussels')})

In [30]: df
Out[30]:
dt
0 2015-01-01 00:00:00+01:00
1 2015-01-02 00:00:00+01:00
2 2015-01-03 00:00:00+01:00

In [31]: df.apply(lambda x: x)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-9cd68f0fd3ff> in <module>()
----> 1 df.apply(lambda x: x)

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\frame.py in apply(self, func, a
xis, broadcast, raw, reduce, args, **kwds)
4029                     if reduce is None:
4030                         reduce = True
-> 4031                     return self._apply_standard(f, axis, reduce=reduce)
4032             else:
4033                 return self._apply_broadcast(f, axis)

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\frame.py in _apply_standard(sel
f, func, axis, ignore_failures, reduce)
4076             # Create a dummy Series from an empty array
4077             index = self._get_axis(axis)
-> 4078             empty_arr = np.empty(len(index), dtype=values.dtype)
4079             dummy = Series(empty_arr, index=self._get_axis(axis),
4080                            dtype=values.dtype)

TypeError: data type not understood

# Fixed code
def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
    # skip if we are mixed datelike and trying reduce across axes
    # GH6125
    if reduce and axis == 1 and self._is_mixed_type and self._is_datelike_mixed_type:
        reduce = False

    # try to reduce first (by default)
    # this only matters if the reduction in values is of different dtype
    # e.g. if we want to apply to a SparseFrame, then can't directly reduce
    if reduce:
        values = self.values

        # we cannot reduce using non-numpy dtypes,
        # as demonstrated in gh-12244
        if not is_internal_type(values):
            # Create a dummy Series from an empty array
            index = self._get_axis(axis)
            empty_arr = np.empty(len(index), dtype=values.dtype)
            dummy = Series(empty_arr, index=self._get_axis(axis), dtype=values.dtype)

            try:
                labels = self._get_agg_axis(axis)
                result = lib.reduce(values, func, axis=axis, dummy=dummy, labels=labels)
                return Series(result, index=labels)
            except Exception:
                pass

    dtype = object if self._is_mixed_type else None
    if axis == 0:
        series_gen = (self._ixs(i, axis=1) for i in range(len(self.columns)))
        res_index = self.columns
        res_columns = self.index
    elif axis == 1:
        res_index = self.index
        res_columns = self.columns
        values = self.values
        series_gen = (
            Series.from_array(arr, index=res_columns, name=name, dtype=dtype)
            for i, (arr, name) in enumerate(zip(values, res_index))
        )
    else:  # pragma : no cover
        raise AssertionError("Axis must be 0 or 1, got %s" % str(axis))

    i = None
    keys = []
    results = {}
    if ignore_failures:
        successes = []
        for i, v in enumerate(series_gen):
            try:
                results[i] = func(v)
                keys.append(v.name)
                successes.append(i)
            except Exception:
                pass
        # so will work with MultiIndex
        if len(successes) < len(res_index):
            res_index = res_index.take(successes)
    else:
        try:
            for i, v in enumerate(series_gen):
                results[i] = func(v)
                keys.append(v.name)
        except Exception as e:
            if hasattr(e, "args"):
                # make sure i is defined
                if i is not None:
                    k = res_index[i]
                    e.args = e.args + ("occurred at index %s" % com.pprint_thing(k),)
            raise

    if len(results) > 0 and is_sequence(results[0]):
        if not isinstance(results[0], Series):
            index = res_columns
        else:
            index = None

        result = self._constructor(data=results, index=index)
        result.columns = res_index

        if axis == 1:
            result = result.T
        result = result._convert(datetime=True, timedelta=True, copy=False)

    else:
        result = Series(results)
        result.index = res_index

    return result