0

I have the following dataframe for my experiment result : enter image description here

How can I reshape it to look like this table :

enter image description here

Raghad
  • 55
  • 5
  • 2
    Could you share data as text, not images, as well as the code you've tried so far? https://stackoverflow.com/help/minimal-reproducible-example – Peter Leimbigler May 09 '22 at 20:13
  • [Please don't post pictures of text](https://meta.stackoverflow.com/q/285551/4518341). Instead, copy the text itself, [edit] it into your post, and use the formatting tools like [code formatting](/editing-help#code). See [How to make good reproducible pandas examples](/q/20109391/4518341) for specifics, as well as [mre] in general. – wjandrea May 09 '22 at 20:31

1 Answers1

0

Based on the data you've provided you should be able to use .unstack() to do this:

print(df['counts'].unstack(level=['Model_1', 'Winloss']))
Cameron Riddell
  • 10,942
  • 9
  • 19