I have a column in DataFrame that looks like this:
| Col1 |
|---|
| A |
| B |
| A |
| C |
| B |
I want to add a boolean column that indicates for each row whether the value in that row has appeared in the previous rows. The desired output would look like this:
| Col1 | col2 |
|---|---|
| A | True |
| B | True |
| A | False |
| C | True |
| B | False |
How can I achieve it? I've tried window.expanding() with isin(), but it appears to apply to numeric columns only (mine contains strings only).