ntjohnson1 commented on code in PR #1435:
URL:
https://github.com/apache/datafusion-python/pull/1435#discussion_r3001768485
##########
python/datafusion/functions.py:
##########
@@ -3411,12 +3637,20 @@ def count(
filter: If provided, only compute against rows for which the filter is
True
Examples:
- ---------
- >>> ctx = dfn.SessionContext()
- >>> df = ctx.from_pydict({"a": [1, 2, 3]})
- >>> result = df.aggregate([],
[dfn.functions.count(dfn.col("a")).alias("v")])
- >>> result.collect_column("v")[0].as_py()
- 3
+ >>> ctx = dfn.SessionContext()
+ >>> df = ctx.from_pydict({"a": [1, 2, 3]})
+ >>> result = df.aggregate([],
[dfn.functions.count(dfn.col("a")).alias("v")])
+ >>> result.collect_column("v")[0].as_py()
+ 3
+
+ >>> df = ctx.from_pydict({"a": [1, 1, 2, 3]})
+ >>> result = df.aggregate(
+ ... [], [dfn.functions.count(
+ ... dfn.col("a"), distinct=True,
+ ... filter=dfn.col("a") > dfn.lit(1),
+ ... ).alias("v")])
+ >>> result.collect_column("v")[0].as_py()
+ 2
Review Comment:
The linter is a little odd inside the docstrings so it's semi linter
supported. I did a quick pass to make the formatting more similar throughout
the multi example situations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]