2

I have a dataframe that contains data in the below format

enter image description here

How do I convert this to the following format:

enter image description here

1
  • kindly share data as text, not pics Commented Jun 6, 2022 at 22:47

1 Answer 1

2

Seems like you just need to reshape

>>> pd.DataFrame(df.to_numpy().reshape(-1, 3), columns=['Name', 'ID', 'Marks'])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.