title: Fast way to replace value in sparse dataframe with value from dictionary
body: <p>I have a very sparse dataframe <code>df</code> such as this:</p>
  
  <pre><code>       Apples Bananas Pineapple Mango
  Mary   Apples     NaN       NaN   NaN
  Jane      NaN Bananas       NaN   NaN
  Diego     NaN     NaN       NaN Mango
  Guido     NaN     NaN Pineapple   NaN
  </code></pre>
  
  <p>and I would like to build a dictionary <code>d</code> such as </p>
  
  <pre><code>d = {'Apples':3, 'Bananas':1, 'Pineapple':2, 'Mango': 15}
  </code></pre>
  
  <p>to obtain</p>
  
  <pre><code>       Apples Bananas Pineapple Mango
  Mary        3     NaN       NaN   NaN
  Jane      NaN       1       NaN   NaN
  Diego     NaN     NaN       NaN    15
  Guido     NaN     NaN         2   NaN
  </code></pre>
  
  <p>I can do </p>
  
  <pre><code>df.to_sparse().replace(d)
  </code></pre>
  
  <p>but it's been over 30' and no output yet. My dataframe has 10000 rows times 1500 columns, the dataframe is originally 135MB, that becomes 850kB after to_sparse(). Is there any faster way?</p>