Skip to content

Commit e693e71

Browse files
IndexSeekcpcloud
authored andcommitted
docs(examples): add as_timestamp IntegerValue example
1 parent fb8547c commit e693e71

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ibis/expr/types/numeric.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,26 @@ def as_timestamp(
10821082
-------
10831083
TimestampValue
10841084
`self` converted to a timestamp
1085+
1086+
Examples
1087+
--------
1088+
>>> import ibis
1089+
>>> ibis.options.interactive = True
1090+
>>> t = ibis.memtable(
1091+
... {
1092+
... "int_col": [0, 1730501716, 2147483647],
1093+
... }
1094+
... )
1095+
>>> t.int_col.as_timestamp("s")
1096+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
1097+
┃ TimestampFromUNIX(int_col, SECOND) ┃
1098+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
1099+
│ timestamp │
1100+
├────────────────────────────────────┤
1101+
│ 1970-01-01 00:00:00 │
1102+
│ 2024-11-01 22:55:16 │
1103+
│ 2038-01-19 03:14:07 │
1104+
└────────────────────────────────────┘
10851105
"""
10861106
return ops.TimestampFromUNIX(self, unit).to_expr()
10871107

0 commit comments

Comments
 (0)