# Math

Calculate one or more new columns using math functions.

## Parameters

| Name      | Type        | Description                                                                                                | Is Optional |
| --------- | ----------- | ---------------------------------------------------------------------------------------------------------- | ----------- |
| math\_ops | math\_list  | List of math operations to generate new columns. For example, \["AGE\_COLUMN + 5", "WEIGHT\_COLUMN / 100"] |             |
| names     | value\_list | To alias the new columns, provide a list of column names matching the number of math operations.           | True        |

## Example

Pull a source Dataset and preview it:

```python
ds = rasgo.get.dataset(id)
print(ds.preview())
```

|    | SALESAMOUNT |  TAXAMT | DUEDATE             |
| -: | ----------: | ------: | ------------------- |
|  0 |     3578.27 | 286.262 | 2011-01-10 00:00:00 |
|  1 |     3399.99 | 271.999 | 2011-01-10 00:00:00 |
|  2 |     3399.99 | 271.999 | 2011-01-10 00:00:00 |
|  3 |     699.098 | 55.9279 | 2011-01-10 00:00:00 |
|  4 |     3399.99 | 271.999 | 2011-01-10 00:00:00 |
|  5 |     3578.27 | 286.262 | 2011-01-11 00:00:00 |
|  6 |     3578.27 | 286.262 | 2011-01-11 00:00:00 |
|  7 |     3374.99 | 269.999 | 2011-01-11 00:00:00 |
|  8 |     3399.99 | 271.999 | 2011-01-11 00:00:00 |
|  9 |     3578.27 | 286.262 | 2011-01-12 00:00:00 |

Transform the Dataset and preview the result:

```python
ds2 = ds.math(
    math_ops=['SALESAMOUNT * 10', 'SALESAMOUNT - TAXAMT'],
    names=['SALES10', 'SALESNET'])

ds2.preview()

```

|    | SALESAMOUNT |  TAXAMT | DUEDATE             | SALES10 | SALESNET |
| -: | ----------: | ------: | ------------------- | ------: | -------: |
|  0 |     3578.27 | 286.262 | 2011-01-10 00:00:00 | 35782.7 |  3292.01 |
|  1 |     3399.99 | 271.999 | 2011-01-10 00:00:00 | 33999.9 |  3127.99 |
|  2 |     3399.99 | 271.999 | 2011-01-10 00:00:00 | 33999.9 |  3127.99 |
|  3 |     699.098 | 55.9279 | 2011-01-10 00:00:00 | 6990.98 |   643.17 |
|  4 |     3399.99 | 271.999 | 2011-01-10 00:00:00 | 33999.9 |  3127.99 |
|  5 |     3578.27 | 286.262 | 2011-01-11 00:00:00 | 35782.7 |  3292.01 |
|  6 |     3578.27 | 286.262 | 2011-01-11 00:00:00 | 35782.7 |  3292.01 |
|  7 |     3374.99 | 269.999 | 2011-01-11 00:00:00 | 33749.9 |  3104.99 |
|  8 |     3399.99 | 271.999 | 2011-01-11 00:00:00 | 33999.9 |  3127.99 |
|  9 |     3578.27 | 286.262 | 2011-01-12 00:00:00 | 35782.7 |  3292.01 |

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/math/snowflake/math.sql>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/math.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
