Skip to content

Commit

Permalink
Add pl.Expr.hash Python example (#3679)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer committed Jun 14, 2022
1 parent 4154c6a commit 516eaac
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion py-polars/polars/internals/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2006,12 +2006,35 @@ def hash(self, seed: int = 0, **kwargs: Any) -> "Expr":
"""
Hash the Series.
The hash value is of type `Datetime`
The hash value is of type `UInt64`
Parameters
----------
seed
seed parameter
Examples
--------
>>> df = pl.DataFrame(
... {
... "a": [1, 2, 3],
... }
... )
>>> df.with_column(pl.col("a").hash(0))
shape: (3, 1)
┌─────────────────────┐
│ a │
│ --- │
│ u64 │
╞═════════════════════╡
│ 2818902862237899908 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1584708464793912000 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 8337078092773689561 │
└─────────────────────┘
"""
# kwargs is for backward compatibility
# can be removed later
Expand Down

0 comments on commit 516eaac

Please sign in to comment.