I have a dataframe like below
df = pd.DataFrame({'col1': ['A', 'A', 'B', 'C', 'D', 'D'],
'col2': [1,0,1,0,0,1]})
| col1 | col2 |
|---|---|
| A | 1 |
| A | 0 |
| B | 1 |
| C | 0 |
| D | 0 |
| D | 1 |
If there's one row from col2 = 1, I want to make all col2 rows = 1 for the same value col1 value. The table I'd want is as below:
| col1 | col2 |
|---|---|
| A | 1 |
| A | 1 |
| B | 1 |
| C | 0 |
| D | 1 |
| D | 1 |
Any help is much appreciated!