Im trying to plot a dataframe like this:
A = pd.DataFrame([[1, 5, 2, 8, 2], [2, 4, 4, 20, 2], [3, 3, 1, 20, 2], [4, 2, 2, 1, 0],
[5, 1, 4, -5, -4], [1, 5, 2, 2, -20], [2, 4, 4, 3, 0], [3, 3, 1, -1, -1],
[4, 2, 2, 0, 0], [5, 1, 4, 20, -2]],
columns=['a', 'b', 'c', 'd', 'e'],
index=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
plt.plot(np.cumsum(A.transpose()))
It looks like this:
However, I would like the first print of the chart to start at 0 for all lines. I tried adding another column according to this, but didn't work. For some reason the index didn't change and kept the newly created column at the end in the plot.
A['s'] = 0
cols = list(A)
cols.insert(0, cols.pop(cols.index('s')))
A = A.loc[:, cols]
plt.plot(np.cumsum(A.transpose()))