Write to external files, capture cell output into variables, and more, with cell magic commands.
- [Instructor] A cell magic command … works on the contents of the entire cell. … The magic command does need to be at the top of the cell … for it to work. … There's an importance difference … in calling line magics versus cell magics. … Which is that the cell magic must be pre-pended … by a double percent sign. … Some of the magic commands work … as either line or cell magics … depending on how they're called. … The first cell magic we'll look at is write file. … Let's say I write a function that will get the mean … of whichever column I pass into it. … I think that function could come in handy later, … so I want to save it to a file. … I can type in the write file command at the top of the cell … along with a file name to write to. … And that will write to the file that I gave it. … I can verify that by calling cat on that file. … Let's take a look at another magic called capture. … Similar to the write file command, … I'll put a capture at the top of the cell … followed by a variable name. …
- Running a Jupyter notebook
- Using shortcuts
- Line and cell commands
- Visualizing data with plotting
- Publishing Jupyter notebooks in GitHub
- Presenting your notebooks with the slideshow feature