I have a data set in which a certain rows are getting repeated and i need to drop them
for example:
| Column A | Column B |
|---|---|
| john | 1 |
| next | nan |
| nan | nan |
| 123 | nan |
| smith | 2 |
| Pete | 3 |
| next | nan |
| nan | nan |
| 123 | nan |
| Angie | 2 |
| tom | 3 |
so every time 'Next' comes in 'column A', 3 rows including the row that contains 'next' needs to be deleted.
how can i solve this.
Assuming you don't want to just
dropnaonColumn B, you could use arolling.maxonColumn Ato getNrows after thenext:Output:
Intermediates: