About

Pandas

def discount(df):
    df["30_percent_off"] = df["price"] * 0.7
    return df

def vat(df):
    df["vat"] = df["price"] * 0.2
    return df

def total_cost(df):
    df["total"] = df["30_percent_off"] + df["vat"]
    return df

(df
 .pipe(discount)
 .pipe(vat)
 .pipe(total_cost)
)

Polars

def discount(input_col)r:
    return pl.col(input_col).mul(0.7).alias("70_percent_off")

def vat(input_col):
    return pl.col(input_col).mul(0.2).alias("vat")

def total_cost(input_col1, input_col2):
    return pl.col(input_col1).add(pl.col(input_col2).alias("total")

df.with_columns(
    discount("price"),
    val("price"),
    total_cost("30_percent_off", "vat"),
)