Skip to content

Commit 1914a0b

Browse files
committed
docs: add casting section to user guide with examples for arrow_cast function
1 parent a576cb7 commit 1914a0b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/source/user-guide/common-operations/functions.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Convert to timestamps using :py:func:`~datafusion.functions.to_timestamp`
7878
7979
df.select(f.to_timestamp(col('"Total"')).alias("timestamp"))
8080
81+
8182
String
8283
------
8384

@@ -101,6 +102,17 @@ This also includes the functions for regular expressions like :py:func:`~datafus
101102
f.regexp_replace(col('"Name"'), literal("saur"), literal("fleur")).alias("flowers")
102103
)
103104
105+
Casting
106+
-------
107+
108+
Casting expressions to different data types using :py:func:`~datafusion.functions.arrow_cast`
109+
110+
.. ipython:: python
111+
112+
df.select(
113+
f.arrow_cast(col('"Total"'), "Float64").alias("total_as_float"),
114+
f.arrow_cast(col('"Total"'), "Int32").alias("total_as_int")
115+
)
104116
105117
Other
106118
-----

0 commit comments

Comments
 (0)