fri0
fri0

Reputation: 83

Easy way to copy output from Jupyter to paste in Excel

I'm trying to find a simple way to change the standard output that I get in Jupyter in order to copy and paste tables ouputs in Excel.

For example a simple value_counts() give this kind of output in Jupyter lab/notebook:

0 1030971

1 8766

Is there a simple way to mark, copy and paste keeping the format? Even better, could the table have borders?

PD. I do not need to export results to excel, I only need to copy a few tables of all my output. Thanks in advance!

Upvotes: 7

Views: 9808

Answers (1)

LTheriault
LTheriault

Reputation: 1240

Assuming your DataFrame is named "df", run this line and you'll save the data to your clipboard, letting you paste it where you need to.

df.to_clipboard(excel=True)

Upvotes: 15

Related Questions