Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Create a table in Notebook, or, copy to Excel

Would like to copy some custom output from the contest checker notebook and paste into Excel.
It is a single line list of 10 strings.
When copying from the notebook, one merely needs tabs to be present and then the data will land fine in individual cells.

Simplest might be an html table.
How can a table be created?
Trying raw html, it was not interpreted, the output by Jupyter was plain text like html source.
Many of the solutions on stackoverflow involve .display(), things that cannot be imported here, like HTML().
df.to_clipboard() is blacklisted.

bt.create_full_tear_sheet() creates tables for example but I don't know what method is used.

Anyone?

1 response

An easy way to turn a list into a 'table' is to turn it into a dataframe. Something like this maybe.

string_list = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']  
string_df = pd.DataFrame(string_list)

This adds a column for an index but it can be cut and pasted easily into Excel as a table. That might help?