4

I have an Excel file from Where I have to copy some subset of data to the clipboard so that I can paste it to any place. I am using pandas DataFrame.to_clipboard(excel=True, sep=None, **kwargs) function but I don't want index headers to be copied.

What it is copying is this:

Excel Copied

What I want to copy is this only:

enter image description here

1 Answer 1

14

you have to pass two parameters for that : index and header.

DataFrame.to_clipboard(excel=True, sep=None, index=False, header=None)
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.