0

I am trying to create a line graph from my Pandas Dataframe. The Pandas Dataframe I have looks as follows:

    date    Interrupts_Person   Interrupts_Mean
0   20122013-100-3  0   11.727273
1   20122013-100-6  1   5.428571
2   20122013-17-6   6   8.900000
3   20122013-17-9   0   4.062500
4   20122013-21-4   4   5.637931
5   20122013-22-8   0   5.637931
6   20122013-3-8    0   4.846154
7   20122013-32-6   0   2.727273
8   20122013-32-6   0   2.727273
9   20122013-48-23  0   4.875000
10  20122013-48-23  0   4.875000

It is in total having 51 lines but i just copied the first 10 to keep things readable.I know how to make a simple line graph from a pandas dataframe, but now i want to do the following:

I want a line graph with the date on the X-axis and 2 lines in my graph, one for the column 'interrupts_person' and one for the column 'Interrupts_Mean'. If someone is familliar on how to make a line-graph like thism I would be realy thankfull for some help that continues my progress!

1
  • What does the time 20122013-100-3 represent? Assuming 20122013 to be dmY but 100-3 doesn't make sense. Pandas to_datetime will not be able to convert this to valid format
    – Vaishali
    Commented Mar 26, 2017 at 18:26

1 Answer 1

0

voila mon ami

df['date'] = pd.to_datetime(df['date'])
df.set_index('date', inplace = True)
df[['interrupts_person','Interrupts_Mean']].plot(secondary_y = 'Interrupts_Mean')

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.