def map_values(self, mapping):
        """Replaces this expression with the corresponding value in the
        provided mapping dict, if it is present as a key.

        Examples::

            import fiftyone as fo
            import fiftyone.zoo as foz
            from fiftyone import ViewField as F

            ANIMALS = [
                "bear", "bird", "cat", "cow", "dog", "elephant", "giraffe",
                "horse", "sheep", "zebra"
            ]

            dataset = foz.load_zoo_dataset("quickstart")

            #
            # Replace the `label` of all animal objects in the `predictions`
            # field with "animal"
            #
            mapping = {a: "animal" for a in ANIMALS}
            view = dataset.set_field(
                "predictions.detections",
                F("detections").map(
                    F().set_field("label", F("label").map_values(mapping))
                )
            )

            print(view.count_values("predictions.detections.label"))

        Args:
            mapping: a dict mapping keys to replacement values

        Returns:
            a :class:`ViewExpression`
        """
        keys, values = zip(*list(mapping.items()))

        expr = {
            "$cond": [
                {"$in": ["$$this", "$$keys"]},
                {
                    "$arrayElemAt": [
                        "$$values",
                        {"$indexOfArray": ["$$keys", "$$this"]},
                    ],
                },
                "$$this",
            ]
        }

        if None in mapping:
            none_value = mapping[None]
            expr = {
                "$cond": {
                    "if": {"$gt": ["$$this", None]},
                    "then": expr,
                    "else": none_value,
                }
            }

        return ViewExpression(
            {
                "$let": {
                    "vars": {"this": self, "keys": keys, "values": values},
                    "in": expr,
                }
            }
        )
Replaces this expression with the corresponding value in the
        provided mapping dict, if it is present as a key.

        Examples::

            import fiftyone as fo
            import fiftyone.zoo as foz
            from fiftyone import ViewField as F

            ANIMALS = [
                "bear", "bird", "cat", "cow", "dog", "elephant", "giraffe",
                "horse", "sheep", "zebra"
            ]

            dataset = foz.load_zoo_dataset("quickstart")

            #
            # Replace the `label` of all animal objects in the `predictions`
            # field with "animal"
            #
            mapping = {a: "animal" for a in ANIMALS}
            view = dataset.set_field(
                "predictions.detections",
                F("detections").map(
                    F().set_field("label", F("label").map_values(mapping))
                )
            )

            print(view.count_values("predictions.detections.label"))

        Args:
            mapping: a dict mapping keys to replacement values

        Returns:
            a :class:`ViewExpression`
        
fiftyone/core/expressions.py