@@ -892,53 +892,51 @@ def when(
892
892
empty : _AltOptional [bool ] = Undefined ,
893
893
** constraints : _FieldEqualType ,
894
894
) -> _When :
895
- """Start a `when-then-otherwise` condition.
895
+ """Start a `` when-then-otherwise` ` condition.
896
896
897
- The resulting predicate is an `AND` reduction over `predicate` and optional `*` , `** `, arguments.
897
+ The resulting predicate is an `` AND`` reduction over `` predicate`` and optional ``*`` , ``**` `, arguments.
898
898
899
899
Parameters
900
900
----------
901
901
predicate
902
902
A selection or test predicate.
903
- `str` input will be treated as a test operand.
903
+ `` str` ` input will be treated as a test operand.
904
904
*more_predicates
905
- Additional predicates, restricted to types supporting `& `.
905
+ Additional predicates, restricted to types supporting ``&` `.
906
906
empty
907
- For selection parameters, the predicate of empty selections returns `True` by default.
908
- Override this behavior, with `empty=False`.
907
+ For selection parameters, the predicate of empty selections returns `` True` ` by default.
908
+ Override this behavior, with `` empty=False` `.
909
909
**constraints
910
- Specify [ Field Equal Predicate]( https://vega.github.io/vega-lite/docs/predicate.html#equal-predicate) 's.
911
- Shortcut for `alt.datum.field_name == value`, see examples for usage.
910
+ Specify ` Field Equal Predicate < https://vega.github.io/vega-lite/docs/predicate.html#equal-predicate/>`__ 's.
911
+ Shortcut for `` alt.datum.field_name == value` `, see examples for usage.
912
912
913
913
Returns
914
914
-------
915
- When
916
- A partial state which requires calling `then(statement)` to finish the condition.
915
+ result: When
916
+ A partial state which requires calling ``result. then(statement)` ` to finish the condition.
917
917
918
918
Notes
919
919
-----
920
- - Directly inspired by the `when-then-otherwise` syntax used in `polars.when`.
921
- - `predicate` accepts all inputs valid in `alt.condition(predicate=...)`
920
+ - Directly inspired by the `` when-then-otherwise`` syntax used in `` polars.when` `.
921
+ - `` predicate`` accepts all inputs valid in `` alt.condition(predicate=...)` `
922
922
923
923
References
924
924
----------
925
- [ polars.when]( https://docs.pola.rs/py-polars/html/reference/expressions/api/polars.when.html)
925
+ ` polars.when < https://docs.pola.rs/py-polars/html/reference/expressions/api/polars.when.html/>`__
926
926
927
927
Examples
928
928
--------
929
- Using keyword-argument `constraints` can simplify compositions like:
930
-
931
- ```py
932
- import altair as alt
933
- verbose_composition = (
934
- (alt.datum.Name == "Name_1")
935
- & (alt.datum.Color == "Green")
936
- & (alt.datum.Age == 25)
937
- & (alt.datum.StartDate == "2000-10-01")
938
- )
939
- when_verbose = alt.when(verbose_composition)
940
- when_concise = alt.when(Name="Name_1", Color="Green", Age=25, StartDate="2000-10-01")
941
- ```
929
+ Using keyword-argument ``constraints`` can simplify compositions like::
930
+
931
+ import altair as alt
932
+ verbose_composition = (
933
+ (alt.datum.Name == "Name_1")
934
+ & (alt.datum.Color == "Green")
935
+ & (alt.datum.Age == 25)
936
+ & (alt.datum.StartDate == "2000-10-01")
937
+ )
938
+ when_verbose = alt.when(verbose_composition)
939
+ when_concise = alt.when(Name="Name_1", Color="Green", Age=25, StartDate="2000-10-01")
942
940
"""
943
941
# TODO
944
942
# ----
0 commit comments