Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Datasets] [Docs] Add seealso to map-related methods #30579

Merged
merged 4 commits into from
Jan 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions python/ray/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,20 @@ def map(
must be used.
ray_remote_args: Additional resource requirements to request from
ray (e.g., num_gpus=1 to request GPUs for the map tasks).

.. seealso::

:meth:`~Dataset.flat_map`:
Call this method to create new records from existing ones. Unlike
:meth:`~Dataset.map`, a function passed to :meth:`~Dataset.flat_map`
can return multiple records.

:meth:`~Dataset.flat_map` isn't recommended because it's slow; call
:meth:`~Dataset.map_batches` instead.

:meth:`~Dataset.map_batches`
Call this method to transform batches of data. It's faster and more
flexible than :meth:`~Dataset.map` and :meth:`~Dataset.flat_map`.
"""
if isinstance(fn, CallableClass) and (
compute is None
Expand Down Expand Up @@ -538,6 +552,20 @@ def map_batches(

:meth:`~Dataset.default_batch_format`
Call this function to determine the default batch type.

:meth:`~Dataset.flat_map`:
Call this method to create new records from existing ones. Unlike
:meth:`~Dataset.map`, a function passed to :meth:`~Dataset.flat_map`
can return multiple records.

:meth:`~Dataset.flat_map` isn't recommended because it's slow; call
:meth:`~Dataset.map_batches` instead.

:meth:`~Dataset.map`
Call this method to transform one record at time.

This method isn't recommended because it's slow; call
:meth:`~Dataset.map_batches` instead.
""" # noqa: E501
import pandas as pd
import pyarrow as pa
Expand Down Expand Up @@ -879,6 +907,18 @@ def flat_map(
must be used.
ray_remote_args: Additional resource requirements to request from
ray (e.g., num_gpus=1 to request GPUs for the map tasks).

.. seealso::

:meth:`~Dataset.map_batches`
Call this method to transform batches of data. It's faster and more
flexible than :meth:`~Dataset.map` and :meth:`~Dataset.flat_map`.

:meth:`~Dataset.map`
Call this method to transform one record at time.

This method isn't recommended because it's slow; call
:meth:`~Dataset.map_batches` instead.
"""
if isinstance(fn, CallableClass) and (
compute is None
Expand Down