diff --git a/py-polars/polars/series/array.py b/py-polars/polars/series/array.py index 793ae0507404..a7044c66588b 100644 --- a/py-polars/polars/series/array.py +++ b/py-polars/polars/series/array.py @@ -61,20 +61,14 @@ def sum(self) -> Series: Examples -------- - >>> df = pl.DataFrame( - ... data={"a": [[1, 2], [4, 3]]}, - ... schema={"a": pl.Array(pl.Int64, 2)}, - ... ) - >>> df.select(pl.col("a").arr.sum()) - shape: (2, 1) - ┌─────┐ - │ a │ - │ --- │ - │ i64 │ - ╞═════╡ - │ 3 │ - │ 7 │ - └─────┘ + >>> s = pl.Series([[1, 2], [4, 3]], dtype=pl.Array(pl.Int64, 2)) + >>> s.arr.sum() + shape: (2,) + Series: '' [i64] + [ + 3 + 7 + ] """ def std(self, ddof: int = 1) -> Series: @@ -134,23 +128,21 @@ def unique(self, *, maintain_order: bool = False) -> Series: maintain_order Maintain order of data. This requires more work. + Returns + ------- + Series + Series of data type :class:`List`. + Examples -------- - >>> df = pl.DataFrame( - ... { - ... "a": [[1, 1, 2]], - ... }, - ... schema_overrides={"a": pl.Array(pl.Int64, 3)}, - ... ) - >>> df.select(pl.col("a").arr.unique()) - shape: (1, 1) - ┌───────────┐ - │ a │ - │ --- │ - │ list[i64] │ - ╞═══════════╡ - │ [1, 2] │ - └───────────┘ + >>> s = pl.Series([[1, 1, 2], [3, 4, 5]], dtype=pl.Array(pl.Int64, 3)) + >>> s.arr.unique() + shape: (2,) + Series: '' [list[i64]] + [ + [1, 2] + [3, 4, 5] + ] """ def n_unique(self) -> Series: