کامپوننت Jupyter Notebook
Jupyter Notebook یک برنامه نوتبوک HTML مستقل از زبان برای پروژه Jupyter است. این برنامه به شما امکان میدهد اسنادی ایجاد و به اشتراک بگذارید که شامل کد زنده، معادلات، تصاویر و متن روایی هستند.
نحوه استفاده
استفاده از یک نوتبوک محلی
برای استفاده از شورتکد Jupyter Notebook، باید یک فایل Jupyter Notebook در پروژه خود داشته باشید. مشابه روشی که برای افزودن تصاویر به پروژه استفاده میکنید، میتوانید Jupyter Notebookها را به پوشه assets
اضافه کنید.
- notebook.ipynb
- my-page.md
نوتبوک Jupyter را در صفحه با استفاده از شورتکد jupyter
قرار دهید:
---
title: صفحه من
math: true
---
{{% jupyter "notebook.ipynb" %}}
بهعنوان جایگزین، میتوانید از ویژگی بستههای صفحه هوگو استفاده کنید تا Jupyter Notebookها را همراه با فایل Markdown سازماندهی کنید.
- index.md
- notebook.ipynb
---
title: صفحه من
math: true
---
{{% jupyter "notebook.ipynb" %}}
استفاده از یک نوتبوک راهدور
همچنین میتوانید از یک نوتبوک راهدور با ارائه URL به فایل نوتبوک استفاده کنید. بهعنوان مثال، برای گنجاندن نوتبوک Jupyter Notebook چیست در صفحه، میتوانید از شورتکد زیر استفاده کنید:
{{% jupyter "https://raw.githubusercontent.com/jupyter/notebook/main/docs/source/examples/Notebook/What%20is%20the%20Jupyter%20Notebook.ipynb" %}}
نمونه نوتبوک
What is the Jupyter Notebook?
The Jupyter Notebook is an interactive computing environment that enables users to author notebook documents that include:
- Live code
- Interactive widgets
- Plots
- Narrative text
- Equations
- Images
- Video
These documents provide a complete and self-contained record of a computation that can be converted to various formats and shared with others using email, version control systems (like Git/GitHub) or nbviewer.jupyter.org.
Data Visualization
Below is an example of a simple data visualization using the Seaborn library.
# Import seaborn
import seaborn as sns
# Apply the default theme
sns.set_theme()
# Load an example dataset
tips = sns.load_dataset("tips")
# Create a visualization
sns.relplot(
data=tips,
x="total_bill", y="tip", col="time",
hue="smoker", style="smoker", size="size",
)
tips.head()
Equations
The following is an example of a simple equation using LaTeX.