Answers for "pandas turn column of list into binary"

0

pandas turn column of list into binary

print(
    df.explode("categories")
    .pivot_table(
        index="item", columns="categories", aggfunc="size", fill_value=0
    )
    .reset_index()
)
Posted by: Guest on April-01-2022

Code answers related to "pandas turn column of list into binary"

Python Answers by Framework

Browse Popular Code Answers by Language