ntjohnson1 commented on code in PR #1411:
URL:
https://github.com/apache/datafusion-python/pull/1411#discussion_r2892131806
##########
python/datafusion/functions.py:
##########
@@ -581,22 +640,65 @@ def coalesce(*args: Expr) -> Expr:
def cos(arg: Expr) -> Expr:
- """Returns the cosine of the argument."""
+ """Returns the cosine of the argument.
+
+ Examples:
+ ---------
+ >>> ctx = dfn.SessionContext()
+ >>> df = ctx.from_pydict({"a": [0,-1,1]})
+ >>> cos_df = df.select(dfn.functions.cos(dfn.col("a")).alias("cos"))
+ >>> cos_df.collect_column("cos")[0].as_py()
+ 1.0
+ """
return Expr(f.cos(arg.expr))
def cosh(arg: Expr) -> Expr:
- """Returns the hyperbolic cosine of the argument."""
+ """Returns the hyperbolic cosine of the argument.
+
+ Examples:
+ ---------
+ >>> ctx = dfn.SessionContext()
+ >>> df = ctx.from_pydict({"a": [0,-1,1]})
+ >>> cosh_df = df.select(dfn.functions.cosh(dfn.col("a")).alias("cosh"))
+ >>> cosh_df.collect_column("cosh")[0].as_py()
+ 1.0
+ """
return Expr(f.cosh(arg.expr))
def cot(arg: Expr) -> Expr:
- """Returns the cotangent of the argument."""
+ """Returns the cotangent of the argument.
+
+ Examples:
+ ---------
+ >>> from math import pi
+ >>> ctx = dfn.SessionContext()
+ >>> df = ctx.from_pydict({"a": [pi / 4]})
+ >>> import builtins
Review Comment:
If we don't like builtins then doctest has an ellipses notation for the
expected returned values as well.
--
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]