[IPython-dev] storing variables *in* the notebook

Zoltán Vörös zvoros at gmail.com
Thu Jan 26 14:10:45 EST 2017


Hi Antonio,


Thanks! Actually, this is how I do it at the moment, and it is certainly 
better than nothing. With small variables, it is quite OK, the 
medium-sized items (an array with 1000 elements, say) are a bit more 
problematic, though.

Cheers,

Zoltán



On 01/26/2017 06:20 PM, Antonino Ingargiola wrote:
> Hi Zoltan,
>
> just a simple comment.
>
> If the data is not big, why not copying it verbatim in a code cell? 
> Even in a very long single line if you do not wish to clobber the 
> visual aspect. That way the notebook would be self-contained.
>
> My 2-cents.
> Antonio
>
> On Wed, Jan 25, 2017 at 11:45 PM, Zoltán Vörös <zvoros at gmail.com 
> <mailto:zvoros at gmail.com>> wrote:
>
>     Hi Thomas,
>
>
>     Thanks for the comments! Here are mine.
>
>
>     On 01/25/2017 11:20 PM, Thomas Kluyver wrote:
>
>         On 25 January 2017 at 21:33, Zoltán Vörös <zvoros at gmail.com
>         <mailto:zvoros at gmail.com> <mailto:zvoros at gmail.com
>         <mailto:zvoros at gmail.com>>> wrote:
>
>             Now, the standard answer to this problem is the %store
>         magic, but
>             that has at least two problems (one is actually more like a
>             feature). First, as far as I understand, it saves the variable
>             into a separate file, therefore, the notebook itself is not
>             "portable" anymore: if I want to give it to someone, or
>         use it on
>             another computer, then I need the extra file, but then I could
>             just save the variable in a file in the first place.
>
>
>         In many cases, we think that the unit of sharing should be a
>         directory containing notebooks and associated data files,
>         rather than a notebook itself. Storing and retrieving data in
>         a notebook would require breaking the abstraction that the
>         code inside a notebook doesn't know about the document it's
>         part of.
>
>
>     But by the same token, by resorting to the %store magic, the code
>     inside the notebook is linked to something on the file system, in
>     fact, surreptitiously in a way. I am afraid, I don't quite see,
>     why and how %store is different in this respect.
>
>     To me, one of the main appeals of the notebook is that one can
>     write a report/log (by this I mean create figures, do data
>     analysis/simulation and add context, explanation etc.) in a single
>     document, portably, and without clobbering the file system. I
>     believe, the use case I mentioned earlier is a logical extension
>     of this concept.
>
>     The over-arching theme of the whole ipython project is that data,
>     analysis, presentation and narrative should not be separated.
>     Metadata are routinely attached to markdown cells, so why could
>     not be done the same for the notebook as well?
>
>     I understand that you do not want people to store GBs of data in
>     the notebook, but that was not the intent of the original question.
>
>
>
>         ActivePapers is a different take on connecting code and data
>         which does package them in a single file; I believe it has
>         some support for using a Jupyter notebook as part of an
>         ActivePaper:
>         https://github.com/khinsen/activepapers-python
>         <https://github.com/khinsen/activepapers-python>
>
>
>     Thanks for the pointer, I will check it out!
>
>
>     Zoltán
>     _______________________________________________
>     IPython-dev mailing list
>     IPython-dev at scipy.org <mailto:IPython-dev at scipy.org>
>     https://mail.scipy.org/mailman/listinfo/ipython-dev
>     <https://mail.scipy.org/mailman/listinfo/ipython-dev>
>
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list