[IPython-User] What's the best way to get data into a notebook?

Thomas Kluyver takowl@gmail....
Thu Aug 16 05:07:12 CDT 2012


On 16 August 2012 02:37, Benjie Chen <benjie@ginkgobioworks.com> wrote:
> I have some code in the notebook that needs to run on an input.
> Currently I have to give people access to some shared drive where they
> can put data into a file, then load it via the notebook. Is there a
> better way to paste data into the notebook as input to some code?

For small datasets (if you're talking about pasting it into the
notebook, I assume it's small), you could use the %%file cell magic to
save data from the notebook, like this:

%%file data.csv
Foo,Foo^2
1,1
2,4
3,9

When you run the cell, it's saved to the filename given at the top,
which you can then open in another cell.

Thomas


More information about the IPython-User mailing list