Skip to content

Commit 885502b

Browse files
committed
Update user documentation to remove deprecated function
1 parent 2ab0698 commit 885502b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,7 @@ it's ``Type 2`` column that are null.
175175
Aggregate Functions
176176
-------------------
177177

178-
You can use any :ref:`Aggregation Function<aggregation>` as a window function. Currently
179-
aggregate functions must use the deprecated
180-
:py:func:`datafusion.functions.window` API but this should be resolved in
181-
DataFusion 42.0 (`Issue Link <https://github.com/apache/datafusion-python/issues/833>`_). Here
178+
You can use any :ref:`Aggregation Function<aggregation>` as a window function. Here
182179
is an example that shows how to compare each pokemons’s attack power with the average attack
183180
power in its ``"Type 1"`` using the :py:func:`datafusion.functions.avg` function.
184181

@@ -189,10 +186,14 @@ power in its ``"Type 1"`` using the :py:func:`datafusion.functions.avg` function
189186
col('"Name"'),
190187
col('"Attack"'),
191188
col('"Type 1"'),
192-
f.window("avg", [col('"Attack"')])
193-
.partition_by(col('"Type 1"'))
194-
.build()
195-
.alias("Average Attack"),
189+
f.avg(col('"Attack"')).over(
190+
Window(
191+
window_frame=WindowFrame("rows", None, None),
192+
partition_by=[col('"Type 1"')],
193+
order_by=[col('"Speed"')],
194+
null_treatment=NullTreatment.IGNORE_NULLS,
195+
)
196+
).alias("Average Attack"),
196197
)
197198
198199
Available Functions

0 commit comments

Comments
 (0)