'Pandas - instead of dropping rows with nan values I want to keep those rows and drop the others in a particular column
I have several column in my df, one is error. If that column has rows with a value (this one always has 99 as the error message value) I want to remove those rows and keep the ones that are nan.
df:
| error | date | count |
|---|---|---|
| 99 | nan | nan |
| nan | 2022-02-01 | 234 |
| nan | 2022-02-02 | 34643 |
| 99 | nan | nan |
| nan | 2022-03-02 | 23425 |
| 99 | nan | nan |
I know how to drop if nan, but I want to do the opposite for the error column
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
