I have a pandas dataframe which currently looks like this.
Original Table
Test Subject | Test1 | Test2 | Test3 |
---|---|---|---|
Subject1 | True | False | False |
Subject2 | True | False | False |
Subject3 | True | False | False |
Subject2 | False | False | False |
Subject2 | False | True | True |
Subject3 | False | False | True |
Is there any possible way for me to group the test subjects and overwrite previous values within their column to make it look like the following without doing it manually?
Desired Table
Test Subject | Test1 | Test2 | Test3 |
---|---|---|---|
Subject1 | True | False | False |
Subject2 | True | True | True |
Subject3 | True | False | True |
Attached code to make the original dataframe from scratch
import pandas as pd
df = pd.DataFrame({'Test Subject': ["Subject1", "Subject2", "Subject3", "Subject2", "Subject2", "Subject3"], 'Test1': [True, True, True, False, False, False], 'Test2': [False, False, False, True, False, False], 'Test3': [False, False, False, False, True, True]})
EDIT: The table formatting seems to be broken for some reason so I've posted photos below of the tables