snowflake.snowpark.functions.square¶

snowflake.snowpark.functions.square(expr: Union[snowflake.snowpark.column.Column, str]) → Column[source]¶

Returns the square of a numeric expression (expr * expr).

Parameters:

expr (ColumnOrName) – The numeric values to be squared.

Returns:

The square of the input values.

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import col
>>> df = session.create_dataframe([[-2.0], [3.15]], schema=["a"])
>>> df.select(square(col("a")).alias("square")).collect()
[Row(SQUARE=4.0), Row(SQUARE=9.9225)]
>>> df = session.create_dataframe([[4], [5]], schema=["a"])
>>> df.select(square(col("a"), _emit_ast=False).alias("square")).collect()
[Row(SQUARE=16.0), Row(SQUARE=25.0)]
Copy