I am working in .NET Interactive (aka Polyglot) Notebooks in F# (but I believe the same would apply to C#). In my code, I am running functions that ultimately produce an F# list of floating point values, or alternatively might be an F# list of tuples which contain floating point values.
When I ask the notebook to display the variable, it shows the first 20 values and says ".. (more)." Ideally, I would like to either be able to download this data by pressing a link next to the table that's displayed, or alternatively, run some function that can copy the full data to the clipboard - similar to Pandas' to_clipboard function.
Is there a way to do this?
If you want to create a cell that, when run, copies the contents of a data frame to a clipboard, you can do this using the
TextCopy
package. For testing, I used the following (including also Deedle and extension for nicely rendering frames):Let's create a sample data frame and a function to get its contents as CSV string:
To copy
df
to the clipboard, you can run:If you want to create a download link in the notebook output, this is also possible. You can use the
HTML
helper to output custom HTML and inside that, you can use thedata:
format to embed your CSV as a linked file in<a href=...>
(as long as it is not too big):