Polars dataframe doesn't drop column

Category: python python-polars (0 Views)

I have a function in a script that I am testing and the df.drop() function is not working as expected.


def area(df,value):
    df["area"] = df['geo'].apply(lambda row:to_area(row))
    df["area"] = df["area"].apply(lambda row: abs(row - mean))
    df = df.filter(pl.col("area") < value)
    df = df.drop("area")
    return df


def test():
    df = some df
    res = area(df,2)
    res_2 = area(df,4)

At res_2, I keep getting the "area" column back in the dataframe, which is causing me problems with type checking. Any ideas on what might be causing this? I know that using df.clone() works, but I don't understand what is causing this issue with how things are set up.

🔴 No definitive solution yet