Language: Python
Data Science
Jupyter originated from the IPython project in 2014 to support interactive computing across multiple languages (Julia, Python, R – hence the name Ju-Py-R). It has become a standard tool for data analysis, scientific research, and education, allowing users to combine code execution, rich text, and visualizations in a single environment.
Jupyter is an open-source project that provides interactive notebooks for creating and sharing documents that contain live code, equations, visualizations, and narrative text.
pip install notebookconda install -c conda-forge notebookJupyter Notebooks allow you to write and execute code in cells, interleave documentation and results, and visualize data interactively. Notebooks can be exported to various formats including HTML, PDF, and slideshows.
# Terminal command:
jupyter notebookStarts the Jupyter Notebook server and opens a web interface in your default browser.
From the Jupyter web interface, click 'New' → 'Python 3' to create a new notebook.Creates a notebook where you can write Python code in cells and execute them interactively.
a = 10
b = 20
a + bWrite Python code in a cell and press Shift+Enter to execute it; the output is displayed directly below the cell.
Use Markdown to write formatted text, equations using LaTeX, or headings in a notebook cell.You can create rich documentation alongside code to explain analysis, show results, or provide instructions.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0,10,100)
y = np.sin(x)
plt.plot(x,y)
plt.show()Plots interactive graphs directly in the notebook using Matplotlib.
# Terminal command:
jupyter nbconvert --to html notebook.ipynbConverts a notebook to an HTML file for sharing or publication.
Install additional kernels for R, Julia, or other languages to use them in Jupyter notebooks.Jupyter supports multiple programming languages via kernels, making it versatile for different computational tasks.
Keep notebooks organized with clear headings and markdown explanations.
Use version control for notebooks with tools like nbdime to track changes.
Break complex computations into multiple cells for clarity and testing.
Leverage widgets and interactive libraries (like ipywidgets) for interactive dashboards.
Regularly restart the kernel and rerun all cells to ensure reproducibility.