Repository: dask/dask
File: dask/dataframe/core.py (Python)

Code before:
        By default, dask tries to infer the output metadata by running your
        provided function on some fake data. This works well in many cases, but
        can sometimes be expensive, or even fail. To avoid this, you can
        manually specify the output metadata with the ``meta`` keyword. This
        can be specified in many forms, for more information see
        ``dask.dataframe.utils.make_meta``.

        Here we specify the output is a Series with name ``'x'``, and dtype
        ``float64``:

        >>> res = ds.apply(myadd, args=(2,), b=1.5, meta=('x', 'f8'))

        In the case where the metadata doesn't change, you can also pass in
        the object itself directly:

        >>> res = ds.apply(lambda x: x + 1, meta=ds)

        See Also
        --------
        dask.Series.map_partitions
        """
        if convert_dtype is not no_default:
            kwds["convert_dtype"] = convert_dtype

        # let pandas trigger any warnings, such as convert_dtype warning
        self._meta_nonempty.iloc[:0].apply(func, args=args, **kwds)

        if meta is no_default:
            with check_convert_dtype_deprecation():
                meta = _emulate(
                    M.apply, self._meta_nonempty, func, args=args, udf=True, **kwds
                )
            warnings.warn(meta_warning(meta))

        return map_partitions(methods.apply, self, func, args=args, meta=meta, **kwds)

    @derived_from(pd.Series)
    def cov(self, other, min_periods=None, split_every=False):
        from dask.dataframe.multi import concat

        if not isinstance(other, Series):
            raise TypeError("other must be a dask.dataframe.Series")
        df = concat([self, other], axis=1)
        return _cov_corr(
            df, min_periods, scalar=True, numeric_only=False, split_every=split_every
        )

    @derived_from(pd.Series)
    def corr(self, other, method="pearson", min_periods=None, split_every=False):
        from dask.dataframe.multi import concat


Review comment (suggestion):
Probably you mean this:

```suggestion
        self._meta.apply(func, args=args, **kwds)
```

`_meta` is the norm.  `_meta_nonempty` is used when we feel some need to test actual values.

Code after:
        By default, dask tries to infer the output metadata by running your
        provided function on some fake data. This works well in many cases, but
        can sometimes be expensive, or even fail. To avoid this, you can
        manually specify the output metadata with the ``meta`` keyword. This
        can be specified in many forms, for more information see
        ``dask.dataframe.utils.make_meta``.

        Here we specify the output is a Series with name ``'x'``, and dtype
        ``float64``:

        >>> res = ds.apply(myadd, args=(2,), b=1.5, meta=('x', 'f8'))

        In the case where the metadata doesn't change, you can also pass in
        the object itself directly:

        >>> res = ds.apply(lambda x: x + 1, meta=ds)

        See Also
        --------
        dask.Series.map_partitions
        """
        if convert_dtype is not no_default:
            kwds["convert_dtype"] = convert_dtype

        # let pandas trigger any warnings, such as convert_dtype warning
        self._meta.apply(func, args=args, **kwds)

        if meta is no_default:
            with check_convert_dtype_deprecation():
                meta = _emulate(
                    M.apply, self._meta_nonempty, func, args=args, udf=True, **kwds
                )
            warnings.warn(meta_warning(meta))

        return map_partitions(methods.apply, self, func, args=args, meta=meta, **kwds)

    @derived_from(pd.Series)
    def cov(self, other, min_periods=None, split_every=False):
        from dask.dataframe.multi import concat

        if not isinstance(other, Series):
            raise TypeError("other must be a dask.dataframe.Series")
        df = concat([self, other], axis=1)
        return _cov_corr(
            df, min_periods, scalar=True, numeric_only=False, split_every=split_every
        )

    @derived_from(pd.Series)
    def corr(self, other, method="pearson", min_periods=None, split_every=False):
        from dask.dataframe.multi import concat