pythonexcelpandasclipboard

copy pandas Excel Dataframe to clipboard without index header


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


Solution

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

    DataFrame.to_clipboard(excel=True, sep=None, index=False, header=None)