Remove NaN values from dataframe without fillna or Interpolate
<p>I have a dataset: </p>

<pre><code>           367235   419895  992194
1999-01-11  8   5   1
1999-03-23  NaN 4   NaN
1999-04-30  NaN NaN 1
1999-06-02  NaN 9   NaN
1999-08-08  2   NaN NaN
1999-08-12  NaN 3   NaN
1999-08-17  NaN NaN 10
1999-10-22  NaN 3   NaN
1999-12-04  NaN NaN 4
2000-03-04  2   NaN NaN
2000-09-29  9   NaN NaN
2000-09-30  9   NaN NaN
</code></pre>

<p>When I plot it, using <code>plt.plot(df, '-o')</code> I get this: </p>

<p><a href="https://i.stack.imgur.com/sZepY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sZepY.jpg" alt="output from plotting dataframe"></a></p>

<p>But what I would like is for the datapoints from each column to be connected in a line, like so: </p>

<p><a href="https://i.stack.imgur.com/eHxrG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eHxrG.jpg" alt="desired output from plotting dataframe"></a></p>

<p>I understand that matplotlib does not connect datapoints that are separate by NaN values. I looked at all the options <a href="http://pandas.pydata.org/pandas-docs/version/0.8.1/missing_data.html" rel="nofollow noreferrer">here</a> for dealing with missing data, but all of them would essentially misrepresent the data in the dataframe.  This is because each value within the dataframe represents an incident; if I try to replace the NaNs with scalar values or use the interpolate option, I get a bunch of points that are not actually in my dataset. Here's what interpolate looks like: </p>

<p><code>df_wanted2 = df.apply(pd.Series.interpolate)</code> </p>

<p><a href="https://i.stack.imgur.com/BLxxr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BLxxr.png" alt="enter image description here"></a></p>

<p>If I try to use <code>dropna</code> I'll lose entire rows\columns from the dataframe, and these rows hold valuable data. </p>

<p>Does anyone know a way to connect up my dots?  I suspect I need to extract individual arrays from the datasframe and plot them, as is the advice given <a href="https://stackoverflow.com/questions/18430921/matplotlib-not-continuing-lines-after-nans#18430974">here</a>, but this seems like a lot of work (and my actual dataframe is much bigger.)  Does anyone have a solution?</p>