Skip to content

Commit

Permalink
Warn when meta is passed to apply (#10256)
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored May 5, 2023
1 parent 5064339 commit a6ed1b2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dask/dataframe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4330,6 +4330,15 @@ def apply(self, func, convert_dtype=no_default, meta=no_default, args=(), **kwds
M.apply, self._meta_nonempty, func, args=args, udf=True, **kwds
)
warnings.warn(meta_warning(meta))
elif PANDAS_GT_210:
test_meta = make_meta(meta)
if is_dataframe_like(test_meta):
warnings.warn(
"Returning a DataFrame from Series.apply when the supplied function "
"returns a Series is deprecated and will be removed in a future version.",
FutureWarning,
stacklevel=2,
)

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

Expand Down

0 comments on commit a6ed1b2

Please sign in to comment.