{"id":450,"date":"2026-05-08T00:00:00","date_gmt":"2026-05-07T23:00:00","guid":{"rendered":"https:\/\/kosokoking.com\/?p=450"},"modified":"2026-05-02T12:11:39","modified_gmt":"2026-05-02T11:11:39","slug":"getting-started-with-jupyterlab","status":"publish","type":"post","link":"https:\/\/kosokoking.com\/index.php\/technology\/getting-started-with-jupyterlab\/","title":{"rendered":"Getting started with JupyterLab"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">JupyterLab is an interactive development environment that lives in your browser. It combines code execution, data manipulation, and documentation in a single window, which means you stop moving between a terminal, an editor, and a spreadsheet application every time you need to test a hypothesis or explore a dataset.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why reach for JupyterLab<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The appeal comes down to three things working together. First, you can run code in isolated cells, execute a single cell without rerunning everything else, and see results immediately. This matters when you&#8217;re iterating and testing a regex, reshaping a dataset, checking if a hypothesis holds. Second, plots and visualisations render inline, so your data and your visual interpretation sit in the same context. Third, markdown cells let you document your reasoning alongside the code that implements it. When you come back to this notebook six months later, you&#8217;ll understand what you were testing and why.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing JupyterLab<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you already have conda installed, the setup is straightforward:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>conda install -y jupyter jupyterlab notebook ipykernel\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run this from within your active Python environment. Once it completes, start the server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jupyter lab\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This opens JupyterLab in your browser. You&#8217;re now working with a web interface that communicates with a local Python kernel.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The notebook interface<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The notebook is the core document type. Think of it as a cell-based editor where each cell contains either executable code or formatted text. To create a new notebook, click the Python 3 icon under Notebook in the Launcher. You&#8217;ll get a blank notebook with a single empty code cell waiting for input.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Code cells execute Python (or other languages, depending on your kernel). Type your code and press Shift+Enter to run it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Hello, JupyterLab!\")\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The output appears directly below the cell. Markdown cells let you write formatted text, lists, links, and equations using markdown syntax. Use the dropdown in the toolbar to switch cell types, or add new cells with the plus button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The stateful environment is worth understanding because it catches practitioners off guard. Variables you define in one cell remain available in every cell below it, as long as the kernel hasn&#8217;t restarted. If you define\u00a0<code>x = 1<\/code>\u00a0in cell one, then run cell two which prints\u00a0<code>x<\/code>, you&#8217;ll get 1. But if you go back and change cell three to\u00a0<code>x = 2<\/code>, re-run it, then run cell two again, the output changes. The notebook state depends on execution order, not cell order on the page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This creates a common pitfall in that, if you execute cells out of sequence, you can end up with state that doesn&#8217;t match the notebook&#8217;s layout. A cell might reference a variable that hasn&#8217;t been defined yet (in reading order) but was defined earlier in time. For this reason, it&#8217;s good practice to run cells top-to-bottom and restart the kernel occasionally to verify the notebook works from a clean state.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Working with data<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">JupyterLab integrates naturally with pandas and matplotlib. Here&#8217;s a typical workflow:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Create a sample DataFrame\ndata = pd.DataFrame({\n    \"column1\": np.random.rand(50),\n    \"column2\": np.random.rand(50) * 10\n})\n\n# Inspect the data\nprint(data.head())\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run this cell and you&#8217;ll see a formatted table output. In the next cell, create a visualisation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Create a scatter plot\nplt.scatter(data&#91;\"column1\"], data&#91;\"column2\"])\nplt.xlabel(\"Column 1\")\nplt.ylabel(\"Column 2\")\nplt.title(\"Scatter Plot\")\nplt.show()\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The plot renders inline. You can adjust axis labels, colours, or plot type in the same cell, re-run it, and see the result immediately. This is where the interactivity pays off because you&#8217;re not writing a script, saving it, running it in a separate window, then editing and repeating, you&#8217;re iterating in place.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Saving and naming your work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The save button is in the toolbar, or use Ctrl+S. Right-click on the notebook tab or filename in the file browser to rename it. Give your notebooks meaningful names as they&#8217;re often shared with others or reviewed later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Restarting the kernel<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The kernel maintains all variable state, imports, and function definitions in memory. If your notebook becomes cluttered with old variables or you encounter unexpected behaviour, restart it from the Kernel menu. You have two options. Restart Kernel preserves your cell outputs but clears all internal state. Alternatively, Restart Kernel and Clear All Outputs removes everything from the notebook.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After restarting, re-run cells from the top to restore the environment. This is useful both for debugging (does the notebook work from a fresh start?) and for clearing out accumulated junk from lengthy exploratory sessions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Get started with JupyterLab: interactive notebooks for data analysis. Create, visualise, and document your Python work.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[730,735,734,736,729,731,737,733,726,732],"class_list":["post-450","post","type-post","status-publish","format-standard","hentry","category-technology","tag-data-analysis","tag-data-exploration","tag-data-visualisation","tag-interactive-development","tag-jupyter-notebooks","tag-jupyterlab","tag-matplotlib","tag-pandas","tag-python","tag-python-tools"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/posts\/450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/comments?post=450"}],"version-history":[{"count":1,"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/posts\/450\/revisions"}],"predecessor-version":[{"id":451,"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/posts\/450\/revisions\/451"}],"wp:attachment":[{"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/media?parent=450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/categories?post=450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kosokoking.com\/index.php\/wp-json\/wp\/v2\/tags?post=450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}