import pandas as pd; import numpy as np;
df = {'id': [1, 2, 3, 4, 5, 6],
'created_at': ['2020-02-01', '2020-02-02', '2020-02-02', '2020-02-02', '2020-02-03','2020-02-02'],
'type': ['red', np.nan, np.nan, 'blue', 'yellow', np.nan]}
df = pd.DataFrame (df, columns = ['id', 'created_at','type'])
If created_at=2020-02-01 and id=2 or 6 drop row else don't drop. I want to obtain this output;
id | created_at | type |
---|---|---|
1 | 2020-02-01 | red |
3 | 2020-02-01 | NaN |
4 | 2020-02-01 | blue |
5 | 2020-02-03 | yellow |
i.e. I don't want to drop all rows with nan value.