Skip to content

Data loaders with jupyter? #1727

Answered by mbostock
nmondon asked this question in Q&A
Oct 7, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

My understanding is that jupyter nbconvert --to notebook --inplace --execute foo.ipynb will execute the notebook, but the output of the cell won’t go to standard output (and thus won’t be accessible via a data loader) — it’ll simply be written back into the foo.ipynb file. So you’ll need a different command that extracts the output of the desired cell(s) from the .ipynb file format.

The .ipynb file format is JSON, so you could use jq to extract cell outputs. For example, this will output the contents of the first cell. (It appears that the JSON format represents each line of output as an array of strings, so -j reconstructs it.)

export default {
  interpreters: {
    ".ipynb": ["jq", "-j", 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nmondon
Comment options

Answer selected by Fil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants