Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple column assignment via woodwork accessor #1495

Open
ParthivNaresh opened this issue Aug 6, 2022 · 0 comments
Open

Support multiple column assignment via woodwork accessor #1495

ParthivNaresh opened this issue Aug 6, 2022 · 0 comments

Comments

@ParthivNaresh
Copy link
Collaborator

ParthivNaresh commented Aug 6, 2022

Currently if a user attempts to assign multiple columns using the woodwork accessor, an error is thrown.

def test_multiple_assignment():
    df = pd.DataFrame()
    df["ints"] = [i for i in range(100)]
    df["bools"] = [True, False, True, False] * 25
    df["datetime"] = pd.date_range("1/1/21", periods=100)

    df_ = pd.DataFrame()
    df_["ints_"] = [f"{i * 2}" for i in range(100)]
    df_["bools_"] = [f"{i * 5}" for i in range(100)]

    df.ww.init()
    df.ww[["ints", "bools"]] = df_
---------------------------------------
ValueError: New column must be of Series type

Whereas

def test_multiple_assignment():
    df = pd.DataFrame()
    df["ints"] = [i for i in range(100)]
    df["bools"] = [True, False, True, False] * 25
    df["datetime"] = pd.date_range("1/1/21", periods=100)

    df_ = pd.DataFrame()
    df_["ints_"] = [f"{i * 2}" for i in range(100)]
    df_["bools_"] = [f"{i * 5}" for i in range(100)]

    df[["ints", "bools"]] = df_

yields the correct assignment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant