Page tree

Trifacta Dataprep



Contents:

   

Contents:


Computes the value of the first argument raised to the value of the second argument. 

Each argument can be a Decimal or Integer literal or a reference to a column containing numeric values.

Wrangle vs. SQL: This function is part of Wrangle , a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.

Basic Usage

Numeric literal example:

pow(10,3)

Output: Returns the value of 10 3, which is 1000.

Column reference example:

pow(MyValue,2)

Output: Returns the value of the MyValue column raised to the power of 2 (squared). 

Syntax and Arguments

pow(base_numeric_value, exp_numeric_value)


ArgumentRequired?Data TypeDescription
base_numeric_valueYstring, decimal, or integerName of column or Decimal or Integer literal that is the base value to be raised to the power of the second argument
exp_numeric_valueYstring, decimal, or integerName of column or Decimal or Integer literal that is the power to which to raise the base value

For more information on syntax standards, see Language Documentation Syntax Notes.

base_numeric_value

Name of the column or numeric literal whose values are used as the bases for the exponential computation.

  • Missing input values generate missing results.
  • Literal numeric values should not be quoted. 
  • Multiple columns and wildcards are not supported.

Usage Notes:

Required?Data TypeExample Value
YesString (column reference) or Integer or Decimal literal2.3

exp_numeric_value

Name of the column or numeric literal whose values are used as the power to which the base-numeric value is raised. 

  • Missing input values generate missing results.
  • Literal numeric values should not be quoted. 
  • Multiple columns and wildcards are not supported.

Usage Notes:

Required?Data TypeExample Value
YesString (column reference) or Integer or Decimal literal5

Examples

Tip: For additional examples, see Common Tasks.

Example - Exponential functions

This example demonstrates the exponential functions.

Functions:

ItemDescription
EXP Function Computes the value of e raised to the specified power. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.
LN Function Computes the natural logarithm of an input value. The value can be a Decimal or Integer literal or a reference to a column containing numeric values.
LOG Function Computes the logarithm of the first argument with a base of the second argument.
POW Function Computes the value of the first argument raised to the value of the second argument. 

Source:

rowNumX
1-2
21
30
41
52
63
74
85

Transformation:


Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula EXP (X)
Parameter: New column name 'expX'

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula LN (expX)
Parameter: New column name 'ln_expX'

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula LOG (X)
Parameter: New column name 'logX'

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula POW (10,logX)
Parameter: New column name 'pow_logX'

Results:

In the following, (null value) indicates that a null value is generated for the computation.

rowNumXexpXln_expXlogXpow_logX
1-20.1353352832366127-2(null value)(null value)
2-10.1353352832366127-0.9999999999999998(null value)(null value)
3010(null value)0
412.718281828459045101
527.389056098930649520.301029995663981141.9999999999999998
6320.08553692318766830.477121254719662443
7454.5981500331442340.60205999132796233.999999999999999
85148.4131591025765750.69897000433601874.999999999999999

See Also for EXAMPLE - Exponentional Functions:

Example - Pythagorean Theorem

In this example, you learn how to compute exponentials and square roots on your numeric data.

Functions:

ItemDescription
POW Function Computes the value of the first argument raised to the value of the second argument. 
SQRT Function Computes the square root of the input parameter.  Input value can be a Decimal or Integer literal or a reference to a column containing numeric values. All generated values are non-negative.

Source:

The dataset below contains values for x and y:

 

XY
34
49
810
3040

Transformation:

You can use the following transformation to generate values for z2

NOTE: Do not add this step to your recipe right now.

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula (POW(x,2) + POW(y,2))
Parameter: New column name 'Z'

You can see how column Z is generated as the sum of squares of the other two columns, which yields z2.

Now, edit the transformation to wrap the value computation in a SQRT function. This step is done to compute the value for z, which is the distance between the two points based on the Pythagorean theorem.

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula SQRT((POW(x,2) + POW(y,2)))
Parameter: New column name 'Z'

Results:

XYZ
345
499.848857801796104
81012.806248474865697
304050

See Also for EXAMPLE - POW and SQRT Functions:

See Also for POW Function:

This page has no comments.