Skip to content
Search
Examples

Transformations

Description

Arithmetic between two columns, written left to right: b minus a. The result becomes a new column rather than replacing either operand.

Documentation

Transformations are expressions over a row, evaluated column by column.

Code

<?php

declare(strict_types=1);

use function Flow\ETL\DSL\{data_frame, from_array, int_schema, ref, schema, to_output};

require __DIR__ . '/vendor/autoload.php';

data_frame()
    ->read(from_array(
        [['a' => 100, 'b' => 200]],
        schema(int_schema('a'), int_schema('b')),
    ))
    ->withEntry('d', ref('b')->minus(ref('a')))
    ->write(to_output(truncate: false))
    ->run();
Contributors

Built in the open.

Join us on GitHub
scroll back to top