Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 743
Gaurav Sahu Avatar asked Sep 11 '25 14:09

Gaurav Sahu


1 Answers

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

DataFrame.to_clipboard(excel=True, sep=None, index=False, header=None)
like image 168
Sherar MDP Avatar answered Sep 13 '25 04:09

Sherar MDP