Seth Stokes
05/15/2024, 9:50 PMparameterize
and inject
?
This is getting me the result, but the column headers are using the name from the original source("raw_fee_type")
Is this expected or am I using this incorrectly?
@parameterize(**{
f"is_{exec_type}": {"raw_fee_type": source("raw_fee_type"), "search_exec_type": value(exec_type)}
for exec_type in ["tas", "block", "efp", "efr", "eoo"]
})
def extract_execution_types(raw_fee_type: pd.Series, search_exec_type: str) -> pd.Series:
return raw_fee_type.str.contains(search_exec_type, na=False)
@inject(
all_execution_types=group(*[
source(f"is_{exec_type}")
for exec_type in ["tas", "block", "efp", "efr", "eoo"]
])
)
def execution_types(all_execution_types: List[pd.Series]) -> pd.DataFrame:
return pd.concat(all_execution_types, axis="columns")
Seth Stokes
05/15/2024, 9:59 PMsource("raw_fee_type")
@resolve(
when=ResolveAt.CONFIG_AVAILABLE,
decorate_with=lambda exec_types: inject(
all_execution_types=group(
*[source(f"is_{exec_type}") for exec_type in exec_types]
)
),
)
def execution_types_df(all_execution_types: List[pd.Series]) -> pd.DataFrame:
return pd.concat(all_execution_types, axis="columns")
Elijah Ben Izzy
05/15/2024, 10:11 PMSeth Stokes
05/15/2024, 10:25 PMraw_fee_type.str.contains(search_exec_type, na=False).rename(f"is_{search_exec_type}")