Python - ValueError: Cannot index with vector containing NA / NaN values : <p>I'm trying to get the average price of products containing any substrings from a wordlist from a dataframe. I've been able to do so with the following code on multiple spreadsheets - </p>

<pre><code>dframe['Product'].fillna('', inplace=True)
dframe['Price'].fillna(0, inplace=True)
total_count = 0
total_price = 0
for word in ransomware_wordlist:
    mask = dframe.Product.str.contains(word, case=False)
    total_count += mask.sum()
    total_price += dframe.loc[mask, 'Price'].sum()
average_price = total_price / total_count
print(average_price)
</code></pre>

<p>However, one of the spreadsheets throws an error at line -</p>

<pre><code>dframe['Product'].fillna('', inplace=True)
</code></pre>

<p>with</p>

<pre><code>ValueError: cannot index with vector containing NA / NaN values
</code></pre>

<p>I fail to understand why <code>dframe['Product'].fillna('', inplace=True)</code> isn't handling this problem.</p>

<p>In desperate need of some help! Thanks!</p>
