0

[What I am starting out withWhat I want to end up with](https://i.stack.imgur.com/xW8Zf.jpg)I am having trouble writing the code to transform this dataset into what you see below. I am a beginner and am just practicing using Python.

So far, I have tried the str.split, but it didn’t produce the results I was hoping for.

  • Have you tried using `df.melt` and then `str.split`? – Rehan Rajput Feb 03 '23 at 17:46
  • See how to use `melt` [here](https://stackoverflow.com/a/34376252/16726018) and [here](https://pandas.pydata.org/docs/reference/api/pandas.melt.html) – Rehan Rajput Feb 03 '23 at 17:47
  • can you add sample of data in text so one can try and fix it? – rezan21 Feb 03 '23 at 22:08
  • Refrain from showing your dataframe as an image. Your question needs a minimal reproducible example consisting of sample input, expected output, actual output, and only the relevant code necessary to reproduce the problem. See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) for best practices related to Pandas questions. – itprorh66 Feb 03 '23 at 22:38

0 Answers0