[IPython-User] Reusable notebooks
Mon Jul 23 15:45:02 CDT 2012
This is a good idea, thanks for the help.
Also, is there an "execute all" command from the notebook to rerun all
cells in a notebook from top to bottom in the current build? I think this
would be a quick/dirty working way to do something like this before writing
the script that you mentioned.
On Mon, Jul 23, 2012 at 4:00 PM, Thomas Kluyver <firstname.lastname@example.org> wrote:
> Hi Adam,
> This is a topic that's of interest to many of us working on IPython -
> how can we combine our quick, exploratory style of coding with
> something lasting that can be verified and replicated. We don't claim
> to have all the answers, but we think the notebook is a very useful
> step in that direction.
> On 23 July 2012 20:37, Adam Hughes <email@example.com> wrote:
> > I created a notebook that takes in a datafile and does analysis to it
> > on my very customized needs. I would not share this with anyone;
> however, I
> > do want to reuse it for several different datafiles. What I'm doing now
> > manually changing the name of the datafile at the top of the notebook and
> > then just doing shift+enter to rerun everything one cell at a time.
> > My question is how would I change this so that the notebook can be run
> > at once with the datafile as an input. Basically, how can I turn this
> > a standalone script that is run from the command line for example? Is
> > possible in IPython? If so, can you guys direct me to some examples or
> > discussion where it was already covered? I'm having some trouble
> finding my
> > away around notebook resources; they seem scattered around the web a bit.
> I would suggest two possible approaches:
> - Staying in Python, refactor your data analysis so that calling a
> single function runs all the steps. Then running it for several
> datafiles is as simple as writing a for loop at the bottom of the
> - Save the notebook as a Python script (either via the 'File >
> Download as' menu, or start the notebook server with the --script
> option to get a .py file whenever you save a notebook). Then you can
> open it in an editor and adjust it from interactive-use code to
> something that you can run from the command line.
> I've used both of these approaches myself - what makes sense will
> depend on the kind of analysis you're doing, and what sort of workflow
> you want to fit it into - e.g. I have a Makefile to control parts of
> my data analysis, which lends itself to a script & file based
> Best wishes,
> IPython-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User