pandas combine two columns with null values : <p>I have a df with two columns and I want to combine both columns ignoring the NaN values. The catch is that sometimes both columns have NaN values in which case I want the new column to also have NaN. Here's the example: </p>

<pre><code>df = pd.DataFrame({'foodstuff':['apple-martini', 'apple-pie', None, None, None], 'type':[None, None, 'strawberry-tart', 'dessert', None]})

df
Out[10]:
foodstuff   type
0   apple-martini   None
1   apple-pie   None
2   None    strawberry-tart
3   None    dessert
4   None    None
</code></pre>

<p>I tried to use <code>fillna</code> and solve this : </p>

<pre><code>df['foodstuff'].fillna('') + df['type'].fillna('')
</code></pre>

<p>and I got : </p>

<pre><code>0      apple-martini
1          apple-pie
2    strawberry-tart
3            dessert
4                   
dtype: object
</code></pre>

<p>The row 4 has become a blank value. What I wan't in this situation is a NaN value since both the combining columns are NaNs. </p>

<pre><code>0      apple-martini
1          apple-pie
2    strawberry-tart
3            dessert
4            None       
dtype: object
</code></pre>
