Skip to content

Commit b48817c

Browse files
authored
[Docs] Fix incorrect code output in writing-code-snippets doc (#60351)
#59631 changed the way the `Dataset` representations look, but CI didn't test `writing-code-snippet` in that PR's premerge CI. This PR fixes the incorrect output. Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
1 parent b16808c commit b48817c

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

doc/source/ray-contribute/writing-code-snippets.rst

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +155,33 @@ If you're writing a longer example, or if object representations aren't relevant
155155
def transform_batch(batch: Dict[str, np.ndarray]) -> Dict[str, np.ndarray]:
156156
vec_a = batch["petal length (cm)"]
157157
vec_b = batch["petal width (cm)"]
158-
batch["petal area (cm^2)"] = vec_a * vec_b
158+
batch["petal area (cm^2)"] = np.round(vec_a * vec_b, 2)
159159
return batch
160160

161161
transformed_ds = ds.map_batches(transform_batch)
162162
print(transformed_ds.materialize())
163163

164164
.. testoutput::
165165

166-
MaterializedDataset(
167-
num_blocks=...,
168-
num_rows=150,
169-
schema={
170-
sepal length (cm): double,
171-
sepal width (cm): double,
172-
petal length (cm): double,
173-
petal width (cm): double,
174-
target: int64,
175-
petal area (cm^2): double
176-
}
177-
)
166+
shape: (150, 6)
167+
╭───────────────────┬──────────────────┬───────────────────┬──────────────────┬────────┬───────────────────╮
168+
│ sepal length (cm) ┆ sepal width (cm) ┆ petal length (cm) ┆ petal width (cm) ┆ target ┆ petal area (cm^2) │
169+
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
170+
│ double ┆ double ┆ double ┆ double ┆ int64 ┆ double │
171+
╞═══════════════════╪══════════════════╪═══════════════════╪══════════════════╪════════╪═══════════════════╡
172+
│ 5.1 ┆ 3.5 ┆ 1.4 ┆ 0.2 ┆ 0 ┆ 0.28 │
173+
│ 4.9 ┆ 3.0 ┆ 1.4 ┆ 0.2 ┆ 0 ┆ 0.28 │
174+
│ 4.7 ┆ 3.2 ┆ 1.3 ┆ 0.2 ┆ 0 ┆ 0.26 │
175+
│ 4.6 ┆ 3.1 ┆ 1.5 ┆ 0.2 ┆ 0 ┆ 0.3 │
176+
│ 5.0 ┆ 3.6 ┆ 1.4 ┆ 0.2 ┆ 0 ┆ 0.28 │
177+
│ … ┆ … ┆ … ┆ … ┆ … ┆ … │
178+
│ 6.7 ┆ 3.0 ┆ 5.2 ┆ 2.3 ┆ 2 ┆ 11.96 │
179+
│ 6.3 ┆ 2.5 ┆ 5.0 ┆ 1.9 ┆ 2 ┆ 9.5 │
180+
│ 6.5 ┆ 3.0 ┆ 5.2 ┆ 2.0 ┆ 2 ┆ 10.4 │
181+
│ 6.2 ┆ 3.4 ┆ 5.4 ┆ 2.3 ┆ 2 ┆ 12.42 │
182+
│ 5.9 ┆ 3.0 ┆ 5.1 ┆ 1.8 ┆ 2 ┆ 9.18 │
183+
╰───────────────────┴──────────────────┴───────────────────┴──────────────────┴────────┴───────────────────╯
184+
(Showing 10 of 150 rows)
178185

179186
When to use *literalinclude*
180187
============================

0 commit comments

Comments
 (0)