'Remove a row based on two empty columns in python pandas

I want to be able to remove rows that are empty in column NymexPlus and NymexMinus right now the code I have is

df.dropna(subset=['NymexPlus'], inplace=True)

The thing about this code is that it will also delete rows in the column NymexMinus which I don't want to happen. Is there an If/AND statement that will work in terms of only getting rid of empty cells for both of the columns?



Solution 1:[1]

Use a list as subset parameter and how='all':

df.dropna(subset=['NymexPlus', 'NymexMinus'], how='all', inplace=True)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Corralien