pandas - apply replace function with condition row-wise
<p>Starting with this dataframe <code>df</code>:</p>

<pre><code>     0     1     2
02  en    it  None
03  en  None  None
01  nl    en   fil
</code></pre>

<p>There are some missing values. I'm trying to apply a replace function row-wise, e.g. in pseudocode:</p>

<pre><code>def replace(x):
    if 'fil' and 'nl' in row:
        x = ''
</code></pre>

<p>I know that I can do someting like:</p>

<pre><code>df.apply(f, axis=1)
</code></pre>

<p>with a function <code>f</code> defined like:</p>

<pre><code>def f(x):
    if x[0] == 'nl' and x[2] == 'fil':
        x[0] = ''
    return x
</code></pre>

<p>obtaining:</p>

<pre><code>     0     1     2
02  en    it  None
03  en  None  None
01        en   fil
</code></pre>

<p>but a priori I don't know the actual positions of the strings through the columns, so I have to search with something like the <code>isin</code> method, but row-wise.</p>

<p>EDIT: every string can appear anywhere throughout the columns.</p>