Free AI web copilot to create summaries, insights and extended knowledge, download it at here
1589
Abstract
"gist-iframe" src="/gist/timo-boehm/73d9d4c62228dc915a3dafdaedba0537.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><h2 id="4bdc">%matplotlib</h2><p id="2296">If you did an online course before, you probably recognize this magic command in combination with the <b>inline </b>parameter. Using this command ensures that Jupyter Notebooks show your plots. Probably the most critical magic command for every report based on a notebook.</p>
<figure id="81b2">
<div>
<div>
<iframe class="gist-iframe" src="/gist/timo-boehm/aee3acf5568dbbb56ced40c1e45111d4.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><h2 id="4996">%load_ext autoreload</h2><p id="fb65">This magic command allows you to load the most important extension: <b>autoreload</b>. Without it, you have to reload the kernel every time you change something in your referenced code. The code snippet gives you a brief example of how to use it:</p>
<figure id="8240">
<div>
<div>
<iframe class="gist-iframe" src="/gist/timo-boehm/9a9e59bf4f68da3e2e468f7fb6d0183a.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><h2 id="cb9f">%system</h2><p id="7a06">If y
Options
ou want to use the shell, this magic command does the trick for you. It’s very nice for fast check of the current directory and similar things. It doesn’t look like much, but it is a good tool to have in your belt.</p>
<figure id="f6d1">
<div>
<div>
<iframe class="gist-iframe" src="/gist/timo-boehm/1a6a9b9adc0e739ba440e17d48c3fc26.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><h2 id="3651">%who_ls</h2><p id="91e7">This magic command does one thing very well: showing you the list of variables in your environment. You can also add a parameter to define what type of variables, e.g. functions, you want to see.</p>
<figure id="510e">
<div>
<div>
<iframe class="gist-iframe" src="/gist/timo-boehm/fc64c348167bbc5427608d99c87d916a.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="6f3f">Of course, there are way more magic commands than I covered in this post. See <a href="https://ipython.readthedocs.io/en/stable/interactive/magics.html">here </a>for the official documentation. What magic commands do you use and why? Let me know in the comments or on <a href="https://twitter.com/TimoBohm">Twitter</a>. <b>Thanks for reading, leave some 👏🏻 if it helped you and let’s keep on learning!</b></p></article></body>