Reverse a get_dummies encoding in pandas

Pretty one-liner 🙂

new_df = df.idxmax(axis=1)

Leave a Comment