Skip to content

Commit

Permalink
docs(arbitrary): add example for arbitrary method docstring (#9596)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Jul 15, 2024
1 parent 9b797f6 commit 09cfd85
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ibis/expr/types/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,31 @@ def arbitrary(
-------
Scalar
An expression
Examples
--------
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"a": [1, 2, 2], "b": list("aaa"), "c": [4.0, 4.1, 4.2]})
>>> t
┏━━━━━━━┳━━━━━━━━┳━━━━━━━━━┓
┃ a ┃ b ┃ c ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━━━┩
│ int64 │ string │ float64 │
├───────┼────────┼─────────┤
│ 1 │ a │ 4.0 │
│ 2 │ a │ 4.1 │
│ 2 │ a │ 4.2 │
└───────┴────────┴─────────┘
>>> t.group_by("a").agg(arb=t.b.arbitrary(), c=t.c.sum())
┏━━━━━━━┳━━━━━━━━┳━━━━━━━━━┓
┃ a ┃ arb ┃ c ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━━━┩
│ int64 │ string │ float64 │
├───────┼────────┼─────────┤
│ 2 │ a │ 8.3 │
│ 1 │ a │ 4.0 │
└───────┴────────┴─────────┘
"""
if how is not None:
warn_deprecated(
Expand Down

0 comments on commit 09cfd85

Please sign in to comment.