[IPython-User] embed data in notebooks?

Thomas Kluyver takowl@gmail....
Tue Jun 5 06:45:17 CDT 2012

On 5 June 2012 12:20, Thomas Breuel <tmbdev@gmail.com> wrote:
> Embedded data could be binary data that is read from a file, or possibly
> also the contents of files themselves (the former allows the latter to be
> done quite easily).

I think the only way of doing that at the moment is to store it in Python code:

data = b"\x4e\xcc\nhrs\xa0"

Our vision is 'folder as a project' - so the code in a notebook sits
alongside data files, keeping the notebook file lightweight and
suitable for version control.

I can see there's an argument for having a way to store data as part
of a notebook, but I think there are some questions:
- How would the user interface work: How would the data be brought in
and assigned to a variable? What would be displayed in the notebook?
Would we handle different types of files differently, or treat all
binary files the same?
- How would performance hold up? We'd have to base64 encode the data
to store it in JSON, so loading binary data will inevitably be slower
as it has an extra decoding step. It also increases the size of the
data on disk.
- Is the cost/benefit trade off worth it? This may involve significant
extra complexity in IPython, and it's simple enough to zip up a
notebook file + input data.

Best wishes,

More information about the IPython-User mailing list