Reference Documentation

class hamilton.function_modifiers.parameterize_extract_columns(*extract_config: ParameterizedExtract, reassign_columns: bool = True)#

@parameterize_extract_columns gives you the power of both @extract_columns and @parameterize in one decorator.

It takes in a list of Parameterized_Extract objects, each of which is composed of: 1. A list of columns to extract, and 2. A parameterization that gets used

In the following case, we produce four columns, two for each parameterization:

import pandas as pd
from function_modifiers import parameterize_extract_columns, ParameterizedExtract, source, value
        ("outseries1a", "outseries2a"),
        {"input1": source("inseries1a"), "input2": source("inseries1b"), "input3": value(10)},
        ("outseries1b", "outseries2b"),
        {"input1": source("inseries2a"), "input2": source("inseries2b"), "input3": value(100)},
def fn(input1: pd.Series, input2: pd.Series, input3: float) -> pd.DataFrame:
    return pd.concat([input1 * input2 * input3, input1 + input2 + input3], axis=1)
__init__(*extract_config: ParameterizedExtract, reassign_columns: bool = True)#

Initializes a parameterized_extract decorator. Note this currently works for series, but the plan is to extend it to fields as well…

  • extract_config – A configuration consisting of a list ParameterizedExtract classes These contain the information of a @parameterized and @extract… together.

  • reassign_columns – Whether we want to reassign the columns as part of the function.