title: make pandas DataFrame to a dict and dropna
body: <p>I have some pandas DataFrame with NaNs in it.
  Like this:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  raw_data={'A':{1:2,2:3,3:4},'B':{1:np.nan,2:44,3:np.nan}}
  data=pd.DataFrame(raw_data)
  &gt;&gt;&gt; data
     A   B
  1  2 NaN
  2  3  44
  3  4 NaN
  </code></pre>
  
  <p>Now I want to make a dict out of it and at the same time remove the NaNs.
  The result should look like this:</p>
  
  <pre><code>{'A': {1: 2, 2: 3, 3: 4}, 'B': {2: 44.0}}
  </code></pre>
  
  <p>But using pandas to_dict function gives me a result like this:</p>
  
  <pre><code>&gt;&gt;&gt; data.to_dict()
  {'A': {1: 2, 2: 3, 3: 4}, 'B': {1: nan, 2: 44.0, 3: nan}} 
  </code></pre>
  
  <p>So how to make a dict out of the DataFrame and get rid of the NaNs ?</p>