0

I have a dataframe like this:

values                        values_average    gender    Weeks_before_race
[0.0,21.2,2111.9...]             5.5              M             -10
[0.6,4.33,67.8,...]              6.6              F             -2
.
.
.

The weeks_before_race column begins at -25 weeks out. Each row represents individual and they can be either male or female. I want to plot - on a line graph - the average_values column beginning at -25 weeks out up to 0 weeks out. Below is a screenshot of what I have so far. I need to be able to plot this with one average line for Males and one average line for Females.

enter image description here

Edit I now have an output that looks like this:

gender     weeks_before_race    average
  F              -25               7.7
                 -24              10.11
                   .
                   .
                   .
                  -1                5.5

  M               -25               7.7
                   .
                   .
                   .

All I need to do is plot this data on a single graph, one line showing the average for males and the other line showing the average for females.

Mazz
  • 770
  • 3
  • 11
  • 23
  • Group by gender first, then weeks. Then `.plot()` the groupby. – alkasm Dec 02 '18 at 13:49
  • But that will only give me a single line graph. I need to divide the line into one average line for males and one average line for females, in different colours. – Mazz Dec 02 '18 at 13:53

0 Answers0