Pandas: plot multiple time series DataFrame into a single plot
<p>I have the following pandas DataFrame:</p>

<pre><code>     time      Group      blocks
0     1        A           4
1     2        A           7
2     3        A           12
3     4        A           17
4     5        A           21 
5     6        A           26
6     7        A           33
7     8        A           39
8     9        A           48
9     10       A           59
    ....        ....          ....
36     35      A           231
37     1       B           1
38     2       B           1.5
39     3       B           3
40     4       B           5
41     5       B           6
    ....        ....          ....
911    35      Z           349
</code></pre>

<p>This is a dataframe with multiple time series-ques data, from <code>min=1</code> to <code>max=35</code>. Each <code>Group</code> has a time series like this. </p>

<p>I would like to plot each individual time series A through Z against an x-axis of 1 to 35. The y-axis would be the <code>blocks</code> at each time. </p>

<p>I was thinking of using something like an <a href="http://pandas.pydata.org/pandas-docs/stable/visualization.html" rel="noreferrer">Andrews Curves plot</a>, which would plot each series against one another. Each "hue" would be set to a different group. (Other ideas are welcome.)</p>

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

<p>My problem: how do you format this dataframe to plot multiple series? Should the columns be <code>GroupA</code>, <code>GroupB</code>, etc.? </p>

<p>How do you get the dataframe to be in the format:</p>

<pre><code>time GroupA blocksA GroupsB blocksB GroupsC blocksC....
</code></pre>

<p>Is this the correct format for an Andrews plot as shown? </p>

<p>EDIT</p>

<p>If I try:</p>

<pre><code>df.groupby('Group').plot(legend=False)
</code></pre>

<p>the x-axis is completely incorrect. All time series should be plotted from 0 to 35, all in one series. </p>

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

<p>How do I solve this? </p>