<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Jupyter Notebook  - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Jupyter Notebook  - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Tue, 12 May 2026 22:45:08 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/jupyter-notebook/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Run Rust on Jupyter Notebooks ]]>
                </title>
                <description>
                    <![CDATA[ If you've ever wanted to combine the power of Rust with the interactive goodness of Jupyter notebooks, you're in the right place. Maybe you're tired of compiling every single time you want to test a s ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-run-rust-on-jupyter-notebooks/</link>
                <guid isPermaLink="false">699879483dc17c4862f498f9</guid>
                
                    <category>
                        <![CDATA[ Rust ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Jupyter Notebook  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                    <category>
                        <![CDATA[ WSL ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Tutorial ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Daniel Iwugo ]]>
                </dc:creator>
                <pubDate>Fri, 20 Feb 2026 15:10:00 +0000</pubDate>
                <media:content url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/5e1e335a7a1d3fcc59028c64/6e411f5d-65a1-407d-a4f0-0beceb1e784b.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you've ever wanted to combine the power of Rust with the interactive goodness of Jupyter notebooks, you're in the right place. Maybe you're tired of compiling every single time you want to test a snippet, learn Rust in a more interactive way, or just have a crazy idea pop into your head like I do.</p>
<p>Most people think Jupyter is just for Python and data science stuff, but apparently you can run Rust in one, too.</p>
<p>In this tutorial, we’ll be taking a look at:</p>
<ol>
<li><p><a href="#heading-what-is-evcxr">What is EvCxR?</a></p>
</li>
<li><p><a href="#heading-how-to-install-the-rust-jupyter-kernel">How to Install the Rust Jupyter kernel</a></p>
</li>
<li><p><a href="#heading-step-4-write-your-first-rust-code">How to run your first Rust code in a notebook</a></p>
</li>
<li><p><a href="#heading-handy-tips-and-tricks">Handy Tips and Tricks</a></p>
</li>
<li><p><a href="#heading-common-issues-and-solutions">Common Issues and Solutions</a></p>
</li>
<li><p><a href="#heading-when-not-to-use-jupyter-for-rust">When NOT to Use Jupyter for Rust</a></p>
</li>
</ol>
<p><strong>Friendly Disclaimer</strong>: This tutorial assumes you know the basics of both Rust and Jupyter. If you break something, that's on you, mate 🙂.</p>
<p>So without further ado, let's jump in.</p>
<h2 id="heading-what-is-evcxr"><strong>What is EvCxR?</strong></h2>
<p>EvCxR (pronounced "Evaluator" to my fellow linguists’ horror) is a Rust REPL and Jupyter kernel. It's basically the magic that lets you run Rust code interactively in Jupyter notebooks instead of the traditional compile-run-debug cycle.</p>
<p>The name stands for "Evaluation Context for Rust", and it’s an open source project actively maintained on GitHub. Here are a few things that make this terribly named tool absolutely brilliant:</p>
<ol>
<li><p><strong>Interactive development:</strong> It lets you test Rust snippets without creating a whole project 🧪</p>
</li>
<li><p><strong>Prototyping:</strong> You can quickly try out ideas before committing to a full implementation 💡</p>
</li>
<li><p><strong>Data visualisation:</strong> And yes, you can even plot charts with Rust (more on that later) 📊</p>
</li>
</ol>
<h2 id="heading-how-to-install-the-rust-jupyter-kernel">How to Install the Rust Jupyter kernel</h2>
<h3 id="heading-prerequisites"><strong>Prerequisites</strong></h3>
<p>Before we dive into the installation, make sure you have these sorted:</p>
<ol>
<li><p><strong>A Linux System:</strong> Or at least, Windows Subsystem for Linux (There’s a little note below for Windows users.)</p>
</li>
<li><p><strong>The Rust toolchain:</strong> You can get it from <a href="https://rustup.rs/">rustup.rs</a> if you haven't already</p>
</li>
<li><p><strong>Jupyter:</strong> Install via pip – <code>pip install jupyter</code></p>
</li>
<li><p><strong>Patience:</strong> This might take a minute or two ⏱️</p>
</li>
</ol>
<p>Once you’ve got all that, we can get rusty (pun intended).</p>
<p><strong>Note:</strong> If you’re using Windows, you’ll need to do a little extra to get started. Here’s the quick rundown:</p>
<ol>
<li><p>Go to <a href="https://visualstudio.microsoft.com/visual-cpp-build-tools/">https://visualstudio.microsoft.com/visual-cpp-build-tools/</a></p>
</li>
<li><p>Download and run the installer</p>
</li>
<li><p>Select <strong>"Desktop development with C++"</strong></p>
</li>
<li><p>Install it (it's large, ~5GB)</p>
</li>
</ol>
<h3 id="heading-step-1-install-evcxr"><strong>Step 1: Install EvCxR</strong></h3>
<p>Open your terminal and run this command:</p>
<pre><code class="language-rust">cargo install evcxr_jupyter
</code></pre>
<p>Now go grab a cup of joe ☕. This will take a few minutes as Cargo downloads and compiles everything. And don't panic if it seems stuck. Rust compilation is thorough but not particularly fast.</p>
<p>If you get any errors about missing system libraries, you might need to install some dependencies. On Ubuntu/Debian, try:</p>
<pre><code class="language-bash">sudo apt install jupyter-notebook jupyter-core python-ipykernel
sudo apt install cmake
</code></pre>
<p>On macOS with Homebrew:</p>
<pre><code class="language-bash">brew install cmake jupyter
</code></pre>
<h3 id="heading-step-2-install-the-jupyter-kernel"><strong>Step 2: Install the Jupyter Kernel</strong></h3>
<p>Once the installation finishes, you’ll need to register the EvCxR kernel with Jupyter:</p>
<pre><code class="language-bash">evcxr_jupyter --install
</code></pre>
<p>You should see output that looks something like this at the end:</p>
<pre><code class="language-plaintext">Installation complete
</code></pre>
<h3 id="heading-step-3-launch-jupyter-and-create-a-rust-notebook"><strong>Step 3: Launch Jupyter and Create a Rust Notebook</strong></h3>
<p>Let’s test out our baby. Fire up Jupyter:</p>
<pre><code class="language-bash">jupyter notebook
</code></pre>
<p>Your browser should open automatically (if it doesn't, copy the URL from the terminal).</p>
<p>In the Jupyter interface:</p>
<ol>
<li><p>Click <strong>New</strong> in the top right</p>
</li>
<li><p>Select <strong>Rust</strong> from the dropdown (or "evcxr" depending on your version)</p>
</li>
<li><p>A new notebook opens</p>
</li>
</ol>
<p>Welcome to interactive Rust! 🦀</p>
<h3 id="heading-step-4-write-your-first-rust-code"><strong>Step 4: Write Your First Rust Code</strong></h3>
<p>Let's start with a classic:</p>
<pre><code class="language-rust">println!("Hello my fellow Rustaceans! 🦀");
</code></pre>
<p>Hit <code>Shift + Enter</code> to run the cell. You should see the output appear below the cell. Simple as that.</p>
<p>Note that notebooks execute code at the top level, so you don’t have to wrap it around the <code>main()</code> function. If you still want to do that, you’re going to have to call it like this:</p>
<pre><code class="language-rust">fn main(){
    println!("Hello my fellow Rustaceans! 🦀");
}
//Calling the function
main()
</code></pre>
<p>Now let's try something more interesting:</p>
<pre><code class="language-rust">fn fibonacci(n: u32) -&gt; u32 {
    match n {
        0 =&gt; 0,
        1 =&gt; 1,
        _ =&gt; fibonacci(n - 1) + fibonacci(n - 2)
    }
}

for i in 0..10 {
    println!("fibonacci({}) = {}", i, fibonacci(i));
}
</code></pre>
<p>Run it and watch the Fibonacci sequence appear.</p>
<pre><code class="language-plaintext">fibonacci(0) = 0
fibonacci(1) = 1
fibonacci(2) = 1
fibonacci(3) = 2
fibonacci(4) = 3
fibonacci(5) = 5
fibonacci(6) = 8
fibonacci(7) = 13
fibonacci(8) = 21
fibonacci(9) = 34
</code></pre>
<h2 id="heading-handy-tips-and-tricks"><strong>Handy Tips and Tricks</strong></h2>
<p>Functions aren’t the only things that behave differently when using Rust in notebooks. Here are a few other things you might want to keep in mind:</p>
<h3 id="heading-variables-persist-between-cells">Variables Persist Between Cells</h3>
<p>Unlike traditional Rust compilation, variables you define in one cell stick around for the next cells:</p>
<pre><code class="language-rust">let mut counter = 0;
</code></pre>
<p>Then in the next cell:</p>
<pre><code class="language-rust">counter += 1;
println!("Counter: {}", counter);
</code></pre>
<p>The output would be:</p>
<pre><code class="language-plaintext">Counter: 1
</code></pre>
<p>This is great for building up complex examples step by step.</p>
<h3 id="heading-you-can-use-external-crates">You Can Use External Crates</h3>
<p>Add dependencies with the <code>:dep</code> command in one cell:</p>
<pre><code class="language-rust">:dep serde = { version = "1.0", features = ["derive"] }
:dep serde_json = "1.0"
</code></pre>
<p>Then use them normally in the next:</p>
<pre><code class="language-rust">use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
struct Person {
    name: String,
    age: u32,
}

let person = Person {
    name: "Amina".to_string(),
    age: 24,
};

let json = serde_json::to_string(&amp;person).unwrap();
println!("{}", json);
</code></pre>
<p>Output:</p>
<pre><code class="language-plaintext">{"name":"Amina","age":24}
</code></pre>
<p>Pretty neat, huh?</p>
<h3 id="heading-visualisation-support">Visualisation Support</h3>
<p>You can even create graphs. To get started, install the <code>plotters</code> crate:</p>
<pre><code class="language-rust">:dep plotters = { version = "0.3", default-features = false, features = ["evcxr", "all_series", "bitmap_backend", "bitmap_encoder"] }
</code></pre>
<p>Then create a simple sine graph:</p>
<pre><code class="language-rust">use plotters::prelude::*;

let root = SVGBackend::new("sine_wave.svg", (640, 480)).into_drawing_area();
root.fill(&amp;WHITE).unwrap();

let mut chart = ChartBuilder::on(&amp;root)
    .caption("Sine Wave", ("Arial", 20))
    .margin(5)
    .x_label_area_size(30)
    .y_label_area_size(30)
    .build_cartesian_2d(-3.14..3.14, -1.2..1.2)
    .unwrap();

chart.configure_mesh().draw().unwrap();

chart.draw_series(LineSeries::new(
    (-314..314).map(|x| {
        let x = x as f64 / 100.0;
        (x, x.sin())
    }),
    &amp;RED,
)).unwrap();

root.present().unwrap();
println!("Plot saved to sine_wave.svg");
</code></pre>
<p>Output:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771272251271/c07b1c22-4ea1-408c-984a-4179a47058d9.png" alt="Sine wave graph showing output of the code" style="display:block;margin:0 auto" width="600" height="400" loading="lazy">

<p><strong>A word on plotting:</strong> You can actually display plots directly inline in your notebook. But if you're using WSL with VSCode (like I do), inline plotting may not work properly due to rendering issues on the notebook interface. That’s why I used it as an svg file that I can easily view in my text editor.</p>
<h3 id="heading-checking-types">Checking Types</h3>
<p>Not sure what type something is? Use <code>:vars</code>. This shows all variables and their types:</p>
<pre><code class="language-rust">let x = vec![1, 2, 3];
</code></pre>
<pre><code class="language-rust">:vars
</code></pre>
<p>Output:</p>
<pre><code class="language-plaintext">Variable	    Type
       x	Vec&lt;i32&gt;
</code></pre>
<h2 id="heading-common-issues-and-solutions">Common Issues and Solutions</h2>
<h3 id="heading-compilation-errors-everywhere">Compilation Errors Everywhere</h3>
<p>If you're getting weird compilation errors, remember:</p>
<ul>
<li><p>Each cell is compiled separately</p>
</li>
<li><p>You might need to reimport things in each cell</p>
</li>
</ul>
<h3 id="heading-slow-execution">Slow Execution</h3>
<p>The first time you run code in a session, it's slow due to the compilation overhead. Subsequent runs are faster. If it's really slow, you might want to:</p>
<ul>
<li><p>Use release mode: <code>:opt 2</code></p>
</li>
<li><p>Reduce dependency features to only what you need</p>
</li>
<li><p>Consider if Jupyter is the right tool for your use case</p>
</li>
</ul>
<h3 id="heading-dependencies-not-loading">Dependencies Not Loading</h3>
<p>If a crate won't load:</p>
<ul>
<li><p>Make sure the version exists on <a href="http://crates.io">crates.io</a></p>
</li>
<li><p>Check your internet connection (it needs to download)</p>
</li>
<li><p>Try specifying features explicitly</p>
</li>
<li><p>Clear the cargo cache if things get really wonky: <code>rm -rf ~/.evcxr</code></p>
</li>
</ul>
<h2 id="heading-when-not-to-use-jupyter-for-rust"><strong>When NOT to Use Jupyter for Rust</strong></h2>
<p>Jupyter notebooks are great for learning and experimenting, but they're not always the best choice in:</p>
<ul>
<li><p><strong>Production code:</strong> Use proper projects with cargo</p>
</li>
<li><p><strong>Performance-critical code:</strong> The overhead isn't worth it</p>
</li>
<li><p><strong>Large applications:</strong> Notebooks get very messy, very fast</p>
</li>
<li><p><strong>Team collaboration:</strong> Version control with notebooks is quite the nightmare</p>
</li>
</ul>
<p>Stick to notebooks for prototyping and quick experiments. For anything serious, fire up your favourite editor and create a proper Rust project.</p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>Let's summarise what you've learned:</p>
<ol>
<li><p>How to install the EvCxR Jupyter kernel</p>
</li>
<li><p>How to create and run Rust notebooks</p>
</li>
<li><p>How to use external crates in notebooks</p>
</li>
<li><p>Tips and tricks for interactive Rust development</p>
</li>
</ol>
<p>Jupyter notebooks make Rust more accessible for learning and experimentation. Give it a go next time you want to try out a quick Rust snippet without the ceremony of creating a full project. And with that, we've come to the end of this tutorial.</p>
<p>Cheers.</p>
<h2 id="heading-resources">Resources</h2>
<ol>
<li><p><a href="https://github.com/evcxr/evcxr">EvCxR GitHub Repository</a></p>
</li>
<li><p><a href="https://doc.rust-lang.org/book/">Rust Book</a></p>
</li>
<li><p><a href="https://jupyter.org/documentation">Jupyter Documentation</a></p>
</li>
</ol>
<h2 id="heading-acknowledgements">Acknowledgements</h2>
<p>Thanks to <a href="https://www.linkedin.com/in/a-n-u-o/">Anuoluwapo Victor</a>, <a href="https://www.linkedin.com/in/a-n-u-o/">Chinaza Nwukwa,</a> <a href="https://www.linkedin.com/in/chinaza-nwukwa-22a256230/">Holumidey Mer</a><a href="https://www.linkedin.com/in/mercy-holumidey-88a542232/">cy</a>, <a href="https://www.linkedin.com/in/mercy-holumidey-88a542232/">Favour Ojo,</a> <a href="https://www.linkedin.com/in/favour-ojo-906883199/">Georgina</a> <a href="https://www.linkedin.com/in/georgina-awani-254974233/">Awani</a>, <a href="https://www.linkedin.com/in/georgina-awani-254974233/">and my family</a> for the inspiration, support and knowledge used to put this post together.</p>
<p>And thanks to the EvCxR project maintainers for making this possible, the Rust community for being awesome, and to anyone reading this for wanting to learn. You inspire me daily.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Run R Programs Directly in Jupyter Notebook Locally ]]>
                </title>
                <description>
                    <![CDATA[ R is a popular programming language that’s now widely used in research-related fields like Bioinformatics. And to use R, you’ll need to install the R Compiler and R Studio. But did you know that you can also directly run your R code right in a Jupyte... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-run-r-programs-directly-in-jupyter-notebook-locally/</link>
                <guid isPermaLink="false">66feeca1dbd895463237bf4b</guid>
                
                    <category>
                        <![CDATA[ R ]]>
                    </category>
                
                    <category>
                        <![CDATA[ R Language ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Jupyter Notebook  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ jupyterhub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ jupyter ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Miniconda ]]>
                    </category>
                
                    <category>
                        <![CDATA[ anaconda ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Md. Fahim Bin Amin ]]>
                </dc:creator>
                <pubDate>Thu, 03 Oct 2024 19:12:33 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/pUAM5hPaCRI/upload/d8014cab22d10f9bade9077d0d4af34b.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>R is a popular programming language that’s now widely used in research-related fields like Bioinformatics.</p>
<p>And to use R, you’ll need to install the R Compiler and R Studio. But did you know that you can also directly run your R code right in a Jupyter Notebook? This helps in so many ways if you are already used to using Jupyter Notebook for Machine Learning-related tasks using Python.</p>
<p>In this tutorial, I’ll show you exactly how you can set up your local machine to run the R programming language directly in Jupyter Notebook. The processes I am going to show you today are equally applicable to all major operating systems (Windows, MacOS, and Linux OSes).</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-install-conda">Install Conda</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-create-a-new-environment">Create a New Environment</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-activate-your-conda-environment">Activate Your Conda Environment</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-install-ipykernel-and-jupyter">Install ipykernel and jupyter</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-install-r-in-the-conda-environment">Install R in the Conda Environment</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-open-the-jupyter-notebook">Open the Jupyter Notebook</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-run-r-in-jupyter-notebook">Run R in Jupyter Notebook</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<h2 id="heading-install-conda">Install Conda</h2>
<p>You’d normally use Conda to handle multiple environments in Python. And here, we’re going to use the same Conda program to install R in our environment. You can either use <a target="_blank" href="https://www.anaconda.com/">Anaconda</a> or <a target="_blank" href="https://docs.anaconda.com/miniconda/">Miniconda</a>.</p>
<p>I prefer Miniconda as it’s so lightweight. You’ll also get the opportunity to install the latest packages directly using Miniconda. But you can simply go with the Anaconda if you are already comfortable with that.</p>
<h2 id="heading-create-a-new-environment">Create a New Environment</h2>
<p>Many people tend to use the Base environment. But I never like to use the Base environment directly as you typically need multiple environments for handling different package and versions of packages as well.</p>
<p>So I’ll create a new environment where I’ll work on my R programming language-related tasks using Jupyter Notebook.</p>
<p>To create a new Conda environment, simply use the following command:</p>
<pre><code class="lang-bash">conda create --name r-conda
</code></pre>
<p>Here, <code>r-conda</code> is my Conda environment’s name. You can choose any other name, but keep in mind that the conda env name can not have any whitespaces in it.</p>
<p>It will create a new Conda environment named <code>r-conda</code> for me.</p>
<h2 id="heading-activate-your-conda-environment">Activate Your Conda Environment</h2>
<p>If you want to work on a separate conda environment, you’ll need to make sure that you’re activating that specific conda environment before starting to do anything.</p>
<p>I want to work on the <code>r-conda</code> conda environment. So I can simply activate the conda environment using the following command:</p>
<pre><code class="lang-bash">conda activate r-conda
</code></pre>
<p>You need to use the exact conda env name that you want if it’s different than <code>r-conda</code> in the command.</p>
<div data-node-type="callout">
<div data-node-type="callout-emoji">💡</div>
<div data-node-type="callout-text">Keep in mind that you need to activate the conda environment successfully before proceeding further.</div>
</div>

<p>You will see the conda environment’s name as <code>(conda-env-name)</code> at the left side of your terminal.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727898007890/f8bf9ced-6c9e-4198-9116-63a32e7d0f03.png" alt="activate conda env" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-install-ipykernel-and-jupyter">Install <code>ipykernel</code> and <code>jupyter</code></h2>
<p>I always like to install the <code>ipykernel</code> and <code>jupyter</code> in all of my conda environments as they help manage different conda environments’ Jupyter notebooks/labs separately.</p>
<p>So I’m going to install them together in my conda env by using the command below:</p>
<pre><code class="lang-bash">conda install ipykernel jupyter
</code></pre>
<p>This will install both <code>ipykernel</code> and <code>jupyter</code> in the activated conda environment.</p>
<h2 id="heading-install-r-in-the-conda-environment">Install R in the Conda Environment</h2>
<p>To install R directly in the conda environment, simply use the following command:</p>
<pre><code class="lang-bash">conda install -c r r-irkernel
</code></pre>
<p>This will install the necessary components that enable your local computer to run the R program in your Jupyter Notebook.</p>
<h2 id="heading-open-the-jupyter-notebook">Open the Jupyter Notebook</h2>
<p>Now you can open the Jupyter Notebook either by using <code>jupyter notebook</code> or <code>jupyter notebook --ip=0.0.0.0 --port=8889 --no-browser --allow-root --NotebookApp.token=''</code>. Just make sure to modify the IP, port, root configuration, and token as you see fit for your work.</p>
<p>Open the given link in the terminal to open Jupyter Notebook in your web browser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727898291254/b932284e-05af-4eec-a6aa-f6b9ad50dd1c.png" alt="Open Jupyter Notebook" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-run-r-in-jupyter-notebook">Run R in Jupyter Notebook</h2>
<p>After opening Jupyter Notebook in your web browser, when you want to create a new notebook for R, you will get <code>R</code> directly in the “New” menu like the image given below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727898368089/a2d22b41-8ddd-480b-aaa4-65aeafb12f69.png" alt="R in notebook" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>Now, you can use the R language directly in your Jupyter Notebook!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727898457072/05015331-742c-49c5-9325-b1d1cb1fc6cd.png" alt="Run &quot;R&quot; in Jupyter Notebook" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>You can also see the R programming language logo at the top right side of your Notebook.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Thank you for reading the entire article. I hope you have learned something new here.</p>
<p>If you have enjoyed the procedures step-by-step, then don't forget to let me know on <a target="_blank" href="https://twitter.com/Fahim_FBA">Twitter/X</a> or <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>. I would appreciate it if you could endorse me for some relevant skillsets on <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>. I would also recommend that you subscribe to my <a target="_blank" href="https://youtube.com/@FahimAmin">YouTube channel</a> for regular programming-related content.</p>
<p>You can follow me on <a target="_blank" href="https://github.com/FahimFBA">GitHub</a> as well if you are interested in open source. Make sure to check <a target="_blank" href="https://fahimbinamin.com/">my website</a> as well.</p>
<p>Thank you so much! 😀</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Turn Your Jupyter Notebook into a User-Friendly Web App ]]>
                </title>
                <description>
                    <![CDATA[ Being able to build predictive models is a superpower – but you can't make much of these models if users can't use them.  In this article, we will go through the process of building and deploying a machine learning web app using Flask and PythonAnywh... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/machine-learning-web-app-with-flask/</link>
                <guid isPermaLink="false">66bf4ace59320aaba9cc12e6</guid>
                
                    <category>
                        <![CDATA[ deployment ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Jupyter Notebook  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Tooba Jamal ]]>
                </dc:creator>
                <pubDate>Mon, 03 Oct 2022 22:52:51 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/10/Purple-Illustrated-Technology-Blog-Banner-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Being able to build predictive models is a superpower – but you can't make much of these models if users can't use them. </p>
<p>In this article, we will go through the process of building and deploying a machine learning web app using Flask and PythonAnywhere. </p>
<p>Flask is a Python web framework which is easy to work with, and PythonAnyWhere is a web hosting service provided by Anaconda.</p>
<h2 id="heading-how-to-build-a-machine-learning-web-app">How to Build a Machine Learning Web App</h2>
<p>The idea of turning your predictive models into a web app can feel overwhelming. But I promise you it's relatively easy and straightforward. </p>
<p>Here are the steps we'll need to take to do this:</p>
<ol>
<li>Save the machine learning model</li>
<li>Build a web page using HTML</li>
<li>Build a backend using Flask </li>
<li>Style it the way you want</li>
<li>Deploy it to the web</li>
</ol>
<p>I wanted to build a diabetes prediction web app and so I used <a target="_blank" href="https://archive.ics.uci.edu/ml/datasets/Early+stage+diabetes+risk+prediction+dataset.">this</a> dataset to do it. You can use any dataset you like, as the process will stay the same.</p>
<p>Before getting started, let's understand the directory structure we are going to follow. This will be helpful in keeping our files organized and making the deployment easy.</p>
<h3 id="heading-directory-structure">Directory structure</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/Untitled-Workspace.png" alt="Image" width="600" height="400" loading="lazy">
<em>Directory structure we are going to follow</em></p>
<p>I have named my root directory diabetes_app, but you can name yours whatever you want. </p>
<p>We have three more directories and a Python file in diabetes_app (root directory). The Models directory will contain our trained model. The Static directory has two more directories, CSS will have all the stylesheets saved and script will have JavaScript files, if any. Lastly, the Templates folder will have HTML files saved and app.py is our Python file that has the backend (Flask) code.</p>
<p>Now that we have an organized file structure, let's get started.</p>
<h2 id="heading-how-to-save-the-machine-learning-model">How to Save the Machine Learning Model</h2>
<p>Saving the model is the easiest of all tasks. We will use the Python pickle library to do this. </p>
<p>Once you are done with training, testing, and hyperparameter tuning, save the best performing model in a variable. For me the best model was RandomForestsClassifier and I saved it like this:</p>
<pre><code class="lang-python">clf = RandomForestClassifier()
clf.fit(X_train.values, y_train)
</code></pre>
<p>Now <code>clf</code> has my trained RandomForestClassifier model which is ready to be saved in a file. For this, I will have to import the pickle library and save the clf like this: </p>
<pre><code><span class="hljs-keyword">import</span> pickle
pickle.dump(clf, open(<span class="hljs-string">'model.pkl'</span>, <span class="hljs-string">'wb'</span>))
</code></pre><p>pickle.dump() is a function used for saving models. The first parameter is the model name (that is clf in our case) and the second is another function that saves the model in disk. 'model.pkl' is the file name I want my model to be saved in and 'wb' refers to <em>write binary</em> which writes model data into the 'model.pkl' file.</p>
<p>After this step, you will have your model file saved in the same directory you are working in. Don't forget to copy the model.pkl file in the models folder in our project directory. And now that we have saved our model, we are ready to move ahead.</p>
<h2 id="heading-how-to-build-a-web-page-using-html">How to Build a Web Page using HTML</h2>
<p>The main functionality of any machine learning web app is to make predictions. And for that the user will most probably need to answer a few questions if you have not used unstructured data or uploaded some documents in other cases. </p>
<p>The early stage diabetes risk prediction dataset is in .csv form with 17 features (of which 16 are used as input). We will use HTML forms to create a form that a user can fill out to get their predictions. For example:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"{{ url_for('predict')}}"</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"post"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>What is your age?<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"number"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"Age"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Enter your age"</span>                       <span class="hljs-attr">required</span>=<span class="hljs-string">"required"</span> /&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span> 
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>What is your gender?<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">label</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"radio"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"Sex"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"1"</span> <span class="hljs-attr">required</span>=<span class="hljs-string">"required"</span>         /&gt;</span>Male<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">label</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"radio"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"Sex"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"0"</span> <span class="hljs-attr">required</span>=<span class="hljs-string">"required"</span>         /&gt;</span>Female<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Predict<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span> {{ prediction }} <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p>Above, we have created a form with two questions. The action attribute on the form is set to <code>{{ url_for('predict') }}</code> which will render our prediction when the form is submitted. For age, we are providing the user with a number input field, and for gender, we have the radio buttons. </p>
<p>The value attribute contains the value for each radio button. Male has value 1 and female has value 0, which will be used as inputs for our prediction. Make sure each input field has matching value attributes as your final (processed/ ready for prediction) dataset. I had a binary encoded gender feature so I used the values 1 and 0 for gender. </p>
<p>The paragraph tag will display the prediction results. Prediction is a variable that will hold our prediction in the Python file which we will see in the next step.<br>You can add as many questions you want and whatever input type suits you – the functionality will remain the same.</p>
<h2 id="heading-how-to-build-the-backend-using-flask">How to Build the Backend using Flask</h2>
<p>We are on the most interesting step now, which is to build the backend. First have a look at the code and then we will go deeper in it.</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> flask <span class="hljs-keyword">import</span> Flask, request, render_template
<span class="hljs-keyword">import</span> pickle

app = Flask(__name__)

model = pickle.load(open(<span class="hljs-string">'models/model.pkl'</span>, <span class="hljs-string">'rb'</span>))

<span class="hljs-meta">@app.route('/')</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">home</span>():</span>
    <span class="hljs-keyword">return</span> render_template(<span class="hljs-string">'index.html'</span>)

<span class="hljs-meta">@app.route('/predict',methods=['POST'])</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">predict</span>():</span>
    int_features = [int(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> request.form.values()]
    features = [np.array(int_features)]  
    prediction = model.predict(features) 
    result = prediction[<span class="hljs-number">0</span>]

    <span class="hljs-keyword">return</span> render_template(<span class="hljs-string">'index.html'</span>, prediction=result)

<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">"__main__"</span>:
    app.run(debug=<span class="hljs-literal">True</span>)
</code></pre>
<p>Start by importing the libraries we are going to need. We'll need NumPy for handling input values, Flask for making predictions, and pickel to load the model we saved in the first step.</p>
<p>First we create our app object which we will use throughout to build our backend. Secondly, we load our model using the pickel.load() function. This time we have replaced 'wb' with 'rb' which means <em>'read binary'</em>  which tells pickel to read the data. </p>
<p>@app.route('/') means when we are at the homepage of our app and we want to do something here. To do something, we define a function <code>home</code> which renders our HTML file we created in the previous step as our homepage.</p>
<p>@app.route('/predict',methods=['POST']) does the main job of allowing us to make predictions. /predict means we have moved to the predict page of our app. </p>
<p>We define a predict function here, inside which we first store all the input values in an array called int_features using request.form.values(). Once we have our input values, we convert it into a 2D array for prediction and make the prediction like we normally do. Lastly, we store the prediction in the prediction variable which we will use to render result on our web app. </p>
<p>render_template('index.html', prediction=result) tells Flask to assign the result to the prediction variable and render it in our index.html file. </p>
<p>Remember the action attribute set to predict in our HTML? That is the same predict function we have defined here. When the user submits the form, the predict function gets called. </p>
<p>Finally we run our app in the last two lines. debug=True is an optional argument (default is False) which reloads the web page automatically when you make changes to the code. It will be helpful when you do the styling of your app.</p>
<h2 id="heading-how-to-style-the-app-the-way-you-want">How to Style the App the Way You Want</h2>
<p>To keep things simple, I have showed you the simplest way to build a machine learning web app. But you can do a lot with it. </p>
<p>I styled my app into three separate web pages for home, form/ questions, and results. I also added a little bit of JavaScript to render random health related news from all over the globe to the homepage and a little bit of styling to make things look pretty. </p>
<p>The way to link CSS and JavaScript files when working with Flask is this:</p>
<pre><code> &lt;link rel=<span class="hljs-string">"stylesheet"</span> href=<span class="hljs-string">"{{ url_for('static',filename='css/style.css') }}"</span>&gt;
 <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text/javascript"</span> 
  <span class="hljs-attr">src</span>=<span class="hljs-string">"{{ url_for('static',filename='script/script.js') }}"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></span>
</code></pre><p>To add more than one web page, you just need to add more routes to the Python file like we did in the previous step. Let's suppose we want to add a separate results page to show predictions. The /predict route will look like this:</p>
<pre><code>@app.route(<span class="hljs-string">'/predict'</span>,methods=[<span class="hljs-string">'POST'</span>])
def predict():
    int_features = [int(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> request.form.values()]
    features = [np.array(int_features)]  
    prediction = model.predict(features)  
    result = prediction[<span class="hljs-number">0</span>]

    <span class="hljs-keyword">return</span> render_template(<span class="hljs-string">'results.html'</span>, prediction=result)
</code></pre><p>Instead of rendering index.html, we are rendering results.html with our prediction. You can structure and style your results.html file the way you want and add the prediction to it.</p>
<h2 id="heading-how-to-deploy-the-app-to-the-web">How to Deploy the App to the Web</h2>
<p>Now that we are done with styling, the app is ready to be pushed to the cloud. PythonAnywhere is easy to use and has a free plan to deploy Python applications. You will have to create an account first and choose the free plan. </p>
<p>Next, you will need to give your app a name and go to the files tab and delete the existing site there. Upload all your files in the same directory structure discussed above. Then go to the web tab and click the blue reload button. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/pythonanywhere.png" alt="Image" width="600" height="400" loading="lazy">
<em>Uploaded files</em></p>
<p>If you have CSS and JavaScript files in your project, you will need to define their URL and directory path in the static files section on the web tab. </p>
<p>The URL will be /static/ since we are serving static files and the directory will be /home/yourwebsitename/mysite/assets since our CSS and JavaScript files are saved in the static directory.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/paw.png" alt="Image" width="600" height="400" loading="lazy">
<em>Static files section</em></p>
<p>Reload the website by clicking the blue reload button again and CONGRATULATIONS – you have deployed your machine learning web app to the cloud.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Deploying machine learning web apps is not as difficult as it might seem – not at least as learning machine learning theories. And if you have done that, deployment is just a breeze which can take you to greater heights. </p>
<p>I hope this article helped you understand how you can deploy your models and make them look prettier. The code for the diabetes risk assessment web app I built can be found on my <a target="_blank" href="https://github.com/ToobaJamal/diabetes_risk_assessment">GitHub</a>. </p>
<p>Deploy your models and show the world your superpower!</p>
<blockquote>
<p>Interested in connecting on LinkedIn? Hit me up at <a target="_blank" href="https://www.linkedin.com/in/tooba-jamal/">Tooba Jamal</a></p>
</blockquote>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to optimize your Jupyter Notebook ]]>
                </title>
                <description>
                    <![CDATA[ By Pier Paolo Ippolito Introduction Jupyter Notebook is nowadays probably the most used environment for solving Machine Learning/Data Science tasks in Python.  Jupyter Notebook is a client-server application used for running notebook documents in the... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/optimize-your-jupyter-notebook/</link>
                <guid isPermaLink="false">66d46097f855545810e934c1</guid>
                
                    <category>
                        <![CDATA[ Data Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Jupyter Notebook  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 19 Aug 2019 07:44:05 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/1_m87_Htb_9Pstq0UcvNJ49w.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Pier Paolo Ippolito</p>
<h2 id="heading-introduction">Introduction</h2>
<p>Jupyter Notebook is nowadays probably the most used environment for solving Machine Learning/Data Science tasks in Python. </p>
<p>Jupyter Notebook is a client-server application used for running notebook documents in the browser. Notebook documents are documents able to contain both code and rich text elements such as paragraphs, equations, and so on.</p>
<p>In this article, I will walk you through some simple tricks on how to improve your experience with Jupyter Notebook. We will start from useful shortcuts and we will end up adding themes, automatically generated table of contents, and more.</p>
<h2 id="heading-shortcuts">Shortcuts</h2>
<p>Shortcuts can be really useful to speed up writing your code. I will now walk you through some of the shortcuts I found most useful to use in Jupyter.</p>
<p>There are two possible way to interact with Jupyter Notebook: Command Mode and Edit Mode. Some shortcuts work only on one mode or another while others are common to both modes.</p>
<p>Some shortcuts which are common in both modes are:</p>
<ul>
<li><strong>Ctrl + Enter</strong>: to run all the selected cells</li>
<li><strong>Shift + Enter</strong>: run the current cell and move the next one</li>
<li><strong>Ctrl + s</strong>: save notebook</li>
</ul>
<p>In order to enter Jupyter command mode, we need to press Esc and then any of the following commands:</p>
<ul>
<li><strong>H</strong>: show all the shortcuts available in Jupyter Notebook</li>
<li><strong>Shift + Up/Down Arrow</strong>: to select multiple notebook cells at the same time (pressing enter after selecting multiple cells will make all of them run!)</li>
<li><strong>A</strong>: insert a new cell above</li>
<li><strong>B</strong>: insert a new cell below</li>
<li><strong>X</strong>: cut the selected cells</li>
<li><strong>Z</strong>: undo the deletion of a cell</li>
<li><strong>Y</strong>: change the type of cell to Code</li>
<li><strong>M</strong>: change the type of cell to Markdown</li>
<li><strong>Space</strong>: scroll notebook down</li>
<li><strong>Shift + Space</strong>: scroll notebook up</li>
</ul>
<p>In order to enter Jupyter edit mode instead, we need to press Enter and successively any of the following commands:</p>
<ul>
<li><strong>Tab</strong>: code competition suggestions</li>
<li><strong>Ctrl + ]</strong>: indent code</li>
<li><strong>Ctrl + [</strong>: dedent code</li>
<li><strong>Ctrl + z</strong>: undo</li>
<li><strong>Ctrl + y</strong>: redo</li>
<li><strong>Ctrl + a</strong>: select all</li>
<li><strong>Ctrl + Home</strong>: move cursor to cell start</li>
<li><strong>Ctrl + End</strong>: move cursor to the end of the cell</li>
<li><strong>Ctrl + Left</strong>: move cursor one word left</li>
<li><strong>Ctrl + Right</strong>: move cursor one word right</li>
</ul>
<h2 id="heading-shell-commands-and-packages-installation">Shell commands and Packages installation</h2>
<p>Not many users are aware of this, but it is possible to run shell commands in a Jupyter notebook cell by adding an exclamation mark at the beginning of the cell. For example, running a cell with <strong>!ls</strong> will return all the items in the current working directory. Running a cell with <strong>!pwd</strong> will instead print out the current directory file-path.</p>
<p>This same trick can also be applied to install Python packages in Jupyter notebook.</p>
<pre><code class="lang-py">!pip install numpy
</code></pre>
<h2 id="heading-jupyter-themes">Jupyter Themes</h2>
<p>If you are interested in changing how your Jupyter notebook looks, it is possible to install a package with a collection of different themes. The default Jupyter theme looks like the one in Figure 1. In Figure 2 you will see how we will be able to personalise its aspect.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/2-2.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Figure 1: Default Jupyter Notebook Theme</em></p>
<p>We can install our package directly in the notebook using the trick I showed you in the previous section:</p>
<pre><code class="lang-py">!pip install jupyterthemes
</code></pre>
<p>We can the run the following command to list the names of all the available themes:</p>
<pre><code class="lang-py">!jt -l

<span class="hljs-comment"># Cell output:</span>
<span class="hljs-comment"># Available Themes: </span>
<span class="hljs-comment">#   chesterish</span>
<span class="hljs-comment">#   grade3</span>
<span class="hljs-comment">#   gruvboxd</span>
<span class="hljs-comment">#   gruvboxl</span>
<span class="hljs-comment">#   monokai</span>
<span class="hljs-comment">#   oceans16</span>
<span class="hljs-comment">#   onedork</span>
<span class="hljs-comment">#   solarizedd</span>
<span class="hljs-comment">#   solarizedl</span>
</code></pre>
<p>Finally, we can choose a theme using the following command (in this example I decided to use the solarized1 theme):</p>
<pre><code class="lang-py">!jt -t solarizedl
</code></pre>
<p>Once we've run this command and refreshed the page, our notebook should look like the one in Figure 2.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/1-1.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Figure 2: Solarized1 notebook Theme</em></p>
<p>In case you wish anytime to come back to the original Jupyter notebook theme, you can just run the following command and refresh your page.</p>
<pre><code class="lang-py">!jt -r
</code></pre>
<h2 id="heading-jupyter-notebook-extensions">Jupyter Notebook Extensions</h2>
<p>Notebook extensions can be used to enhance the user experience and offer a wide variety of personalization techniques.</p>
<p>In this example, I will be using the <em>nbextensions</em> library in order to install all the necessary widgets (this time I suggest you to first install the packages through terminal and then open the Jupyter notebook). This library makes use of different Javascript models in order to enrich the notebook frontend.</p>
<pre><code class="lang-py">! pip install jupyter_contrib_nbextensions
! jupyter contrib nbextension install --system
</code></pre>
<p>Once <em>nbextensions</em> is installed you will notice that there is an extra tab on your Jupyter notebook homepage (Figure 3).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/image-128.png" alt="Image" width="600" height="400" loading="lazy">
<em>Figure 3: Adding nbextensions to Jupyter notebook</em></p>
<p>By clicking on the Nbextensions tab, we will be provided with a list of available widgets. In my case, I decided to enable the ones shown in Figure 4.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/image-129.png" alt="Image" width="600" height="400" loading="lazy">
<em>Figure 4: nbextensions widgets options</em></p>
<p>Some of my favourite extensions are:</p>
<ol>
<li><strong>Table of Contents</strong></li>
</ol>
<p>Auto-generate a table of contents from markdown headings (Figure 5).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/ezgif.com-optimize-1.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Figure 5: Table of Contents</em></p>
<ol start="2">
<li><strong>Snippets</strong></li>
</ol>
<p>Sample codes to load common libraries and create sample plots which you can use as a starting point for your data analysis (Figure 6).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/snippets.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Figure 6: Snippets</em></p>
<ol start="3">
<li><strong>Hinterland</strong></li>
</ol>
<p>Code autocompletion for Jupyter Notebooks (Figure 7).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/completition.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Figure 7: Code autocompletion</em></p>
<p>The <em>nbextensions</em> library provides many other extensions apart for these three, so I encourage you to experiment and test any other which can be of interest for you!</p>
<h2 id="heading-markdown-options">Markdown Options</h2>
<p>By default, the last output in a Jupyter Notebook cell is the only one that gets printed. If instead we want to automatically print all the commands without having to use <em>print()</em>, we can add the following lines of code at the beginning of the notebook.</p>
<pre><code class="lang-py"><span class="hljs-keyword">from</span> IPython.core.interactiveshell <span class="hljs-keyword">import</span> InteractiveShell
InteractiveShell.ast_node_interactivity = <span class="hljs-string">"all"</span>
</code></pre>
<p>Additionally, it is possible to write LaTex in a Markdown cell by enclosing the text between dollar signs ($).</p>
<h2 id="heading-notebook-slides">Notebook Slides</h2>
<p>It is possible to create a slideshow presentation of a Jupyter Notebook by going to <strong>View -&gt; Cell Toolbar -&gt; Slideshow</strong> and then selecting the slides configuration for each cell in the notebook.</p>
<p>Finally, by going to the terminal and typing the following commands the slideshow will be created.</p>
<pre><code class="lang-py">pip install jupyter_contrib_nbextensions

<span class="hljs-comment"># and successively:</span>

jupyter nbconvert my_notebook_name.ipynb --to slides --post serve
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/ezgif.com-optimize--1-.gif" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-magic">Magic</h2>
<p>Magics are commands which can be used to perform specific commands. Some examples are: inline plotting, printing the execution time of a cell, printing the memory consumption of running a cell, and so on.</p>
<p>Magic commands which start with just one <em>%</em> apply their functionality just for one single line of a cell (where the command is placed). Magic commands which instead start with two <em>%%</em> are applied to the whole cell.</p>
<p>It is possible to print out all the available magic commands by using the following command:</p>
<pre><code class="lang-py">%lsmagic
</code></pre>
<h2 id="heading-contact-info">Contact info</h2>
<p>If you want to keep updated with my latest articles and projects <a target="_blank" href="https://medium.com/@pierpaoloippolito28?source=post_page---------------------------">follow me</a> and subscribe to my <a target="_blank" href="http://eepurl.com/gwO-Dr?source=post_page---------------------------">mailing list</a>. These are some of my contact details:</p>
<ul>
<li><a target="_blank" href="https://uk.linkedin.com/in/pier-paolo-ippolito-202917146?source=post_page---------------------------">Linkedin</a></li>
<li><a target="_blank" href="https://pierpaolo28.github.io/blog/?source=post_page---------------------------">Personal Blog</a></li>
<li><a target="_blank" href="https://pierpaolo28.github.io/?source=post_page---------------------------">Personal Website</a></li>
<li><a target="_blank" href="https://towardsdatascience.com/@pierpaoloippolito28?source=post_page---------------------------">Medium Profile</a></li>
<li><a target="_blank" href="https://github.com/pierpaolo28?source=post_page---------------------------">GitHub</a></li>
<li><a target="_blank" href="https://www.kaggle.com/pierpaolo28?source=post_page---------------------------">Kaggle</a></li>
</ul>
<p>Cover photo <a target="_blank" href="https://gdcoder.com/how-to-create-and-add-a-conda-environment-as-jupyter-kernel/">from this article</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Complete Intro to Jupyter Series (video) ]]>
                </title>
                <description>
                    <![CDATA[ By Gwendolyn Faraday This video series is a deep dive into the popular Jupyter project known for  Jupyterlab and Jupyter Notebooks. More videos in this series coming soon... https://www.youtube.com/watch?v=DnhPAL58m-o&list=PLFBirL3MAv2_d_YO5JWjq3aQC4... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/complete-intro-to-jupyter-series-video/</link>
                <guid isPermaLink="false">66d45eea7df3a1f32ee7f85e</guid>
                
                    <category>
                        <![CDATA[ Jupyter Notebook  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 04 Jun 2019 22:30:32 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5f9ca22b740569d1a4ca52fe.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Gwendolyn Faraday</p>
<p>This video series is a deep dive into the popular Jupyter project known for  Jupyterlab and Jupyter Notebooks.</p>
<p><em>More videos in this series coming soon...</em></p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/DnhPAL58m-o" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/sl-HE2jTs1Q" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
