I need to delete rows from a dataframe if specific columns contains null values:
-> In this example, if col2 and col3 are null:
import pandas as pd
obj = {'col1': [1, 2,7,47,12,67,58], 'col2': [741, 332,7,'Nan',127,'Nan',548], 'col3': ['Nan', 2,74,'Nan',127,'Nan',548] }
df = pd.DataFrame(data=obj)
df.head()
col1 col2 col3
0 1 741 Nan
1 2 332 2
2 7 7 74
3 47 Nan Nan
4 12 127 127
5 67 Nan Nan
6 58 548 548
After delete, the result should be:
df.head()
col1 col2 col3
0 1 741 Nan
1 2 332 2
2 7 7 74
4 12 127 127
6 58 548 548
Thanks for all!