I am trying to use matplotlib to plot the data to mimic the behaviour in the excel screenshot below. I am not able to groupby twice, subsequently, I am getting a join between the 2 series, and they're only being plotted in the single series.
My code:
dataframe:
My code:
fig, ax = plt.subplots(figsize=(8,6)) for lab, d in df.groupby(['label']): df.groupby(['model']) ax.plot(df[df.label==label]["xValue"],df[df.label==label].yValue, label=label, marker='o') The 2nd groupby is not working.How can I fix this?
dataframe:
Output:model label run yValue xValue
v3 SL 101 -5 40
v3 LS 201 -6 42
v3 MS 301 -5.5 41
v4 SL 102 -2 50
v4 LS 202 -4 52
v4 MS 302 -3 51
Larz60+ write Feb-09-2021, 01:20 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.