《Python数据分析技术栈》第01章 02 Jupyter入门(Getting started with Jupyter notebooks)
02 Jupyter入门(Getting started with Jupyter notebooks)
《Python数据分析技术栈》第01章 02 Jupyter入门(Getting started with Jupyter notebooks)
Before we discuss the essentials of Jupyter notebooks, let us discuss what an integrated development environment (or IDE) is. An IDE brings together the various activities involved in programming, like including writing and editing code, debugging, and creating executables. It also includes features like autocompletion (completing what the user wants to type, thus enabling the user to focus on logic and problem-solving) and syntax highlighting (highlighting the various elements and keywords of the language). There are many IDEs for Python, apart from Jupyter, including Enthought Canopy, Spyder, PyCharm, and Rodeo. There are several reasons for Jupyter becoming a ubiquitous, de facto standard in the data science community. These include ease of use and customization, support for several programming languages, platform independence, facilitation of access to remote data, and the benefit of combining output, code, and multimedia under one roof.
在讨论 Jupyter 笔记本的要点之前,让我们先讨论一下什么是集成开发环境(或 IDE)。集成开发环境汇集了编程过程中涉及的各种活动,如编写和编辑代码、调试和创建可执行文件。它还包括自动完成(完成用户想要输入的内容,从而使用户能够专注于逻辑和解决问题)和语法高亮(高亮显示语言的各种元素和关键字)等功能。除了 Jupyter 之外,还有许多 Python 集成开发环境,包括 Enthought Canopy、Spyder、PyCharm 和 Rodeo。Jupyter 成为数据科学界无处不在的事实标准有几个原因。这些原因包括:易于使用和定制、支持多种编程语言、平台独立性、便于访问远程数据,以及将输出、代码和多媒体整合在一个屋檐下的好处。
JupyterLab is the IDE for Jupyter notebooks. Jupyter notebooks are web applications that run locally on a user’s machine. They can be used for loading, cleaning, analyzing, and modeling data. You can add code, equations, images, and markdown text in a Jupyter notebook. Jupyter notebooks serve the dual purpose of running your code as well as serving as a platform for presenting and sharing your work with others. Let us look at the various features of this application.
JupyterLab 是 Jupyter 笔记本的集成开发环境。Jupyter 笔记本是在用户机器上本地运行的网络应用程序。它们可用于加载、清理、分析和建模数据。您可以在 Jupyter 笔记本中添加代码、方程式、图像和标记文本。Jupyter 笔记本具有双重用途,既可以运行代码,也可以作为与他人展示和分享工作的平台。让我们来看看这款应用程序的各种功能。
基本用法
打开面板(Opening the dashboard)
Type “jupyter notebook” in the search bar next to the start menu. This will open the Jupyter dashboard. The dashboard can be used to create new notebooks or open an existing one.
在开始菜单旁边的搜索栏中输入 “jupyter notebook”。这将打开 Jupyter 面板。仪表板可用于创建新笔记本或打开现有笔记本。
创建新的笔记(Creating a new notebook)
Create a new Jupyter notebook by selecting New from the upper right corner of the Jupyter dashboard and then select Python 3 from the drop-down list that appears, as shown in Figure 1-3.
如图 1-3 所示,从 Jupyter 面板右上角选择新建,然后从出现的下拉列表中选择 Python 3,创建一个新的 Jupyter 笔记本。
添加要执行的代码(Entering and executing code)
Click inside the first cell in your notebook and type a simple line of code, as shown in Figure 1-4. Execute the code by selecting Run Cells from the “Cell” menu, or use the shortcut keys Ctrl+Enter.
单击笔记本中的第一个单元格,输入一行简单的代码,如图 1-4 所示。从 "单元格 "菜单中选择 "运行单元格 "或使用快捷键 Ctrl+Enter 执行代码。
print("Hello World")
添加MarkDown文本(Adding markdown text or headings)
In the new cell, change the formatting by selecting Markdown as shown in Figure 1-5, or by pressing the keys Esc+M on your keyboard. You can also add a heading to your Jupyter notebook by selecting Heading from the drop-down list shown in the following or pressing the shortcut keys Esc+(1/2/3/4).
在新单元格中,选择 Markdown(如图 1-5 所示)或按键盘上的快捷键 Esc+M,更改格式。您还可以从下拉列表中选择标题或按快捷键 Esc+(1/2/3/4),为 Jupyter 笔记本添加标题。
重命名笔记(Renaming a notebook)
Click the default name of the notebook and type a new name, as shown in Figure 1-6.
单击笔记本的默认名称并键入新名称,如图 1-6 所示。
You can also rename a notebook by selecting File ➤ Rename.
您还可以通过选择文件 ➤ 重命名来重新命名笔记本。
保存笔记(Saving a notebook)
Press Ctrl+S or choose File ➤ Save and Checkpoint.
按 Ctrl+S 或选择文件 ➤ 保存和检查点。
下载笔记(Downloading the notebook)
You can email or share your notebook by downloading your notebook using the option File ➤ Download as ➤ notebook (.ipynb), as shown in Figure 1-7.
如图 1-7 所示,您可以使用 "文件"➤"下载为➤笔记本(.ipynb)"选项下载笔记本,通过电子邮件发送或共享笔记本。
Jupyter 中的快捷方式和其他功能(Shortcuts and other features in Jupyter)
Let us look at some key features of Jupyter notebooks, including shortcuts, tab completions, and magic commands.
让我们看看 Jupyter 笔记本的一些关键功能,包括快捷方式、选项卡补全和神奇命令。
Table 1-1 gives some of the familiar icons found in Jupyter notebooks, the corresponding menu functions, and the keyboard shortcuts.
表 1-1 列出了 Jupyter 笔记本中一些熟悉的图标、相应的菜单功能和键盘快捷键。

If you are not sure about which keyboard shortcut to use, go to: Help ➤ Keyboard Shortcuts, as shown in Figure 1-8.
如果不确定使用哪个键盘快捷键,请转到 帮助 ➤ 键盘快捷键,如图 1-8 所示。
Commonly used keyboard shortcuts include
- Shift+Enter to run the code in the current cell and move to the next cell.
- Esc to leave a cell.
- Esc+M changes the mode for a cell to “Markdown” mode.
- Esc+Y changes the mode for a cell to “Code”
常用的快捷键包括
- Shift+Enter 运行当前单元格中的代码并移动到下一单元格。
- Esc 离开单元格。
- Esc+M 可将单元格模式更改为 "Markdown "模式。
- Esc+Y 可将单元格模式更改为 "代码 "模式。
使用tab提示(Tab Completion)
This is a feature that can be used in Jupyter notebooks to help you complete the code being written. Usage of tab completions can speed up the workflow, reduce bugs, and quickly complete function names, thus reducing typos and saving you from having to remember the names of all the modules and functions.
这是一项可用于 Jupyter 笔记本的功能,可帮助您完成正在编写的代码。使用制表符补全可以加快工作流程,减少错误,并快速补全函数名称,从而减少错别字,免去记住所有模块和函数名称的麻烦。
For example, if you want to import the Matplotlib library but don’t remember the spelling, you could type the first three letters, mat, and press Tab. You would see a dropdown list, as shown in Figure 1-9. The correct name of the library is the second name in the drop-down list.
例如,如果想导入 Matplotlib 库,但不记得拼写,可以键入前三个字母 mat,然后按 Tab 键。你会看到一个下拉列表,如图 1-9 所示。该库的正确名称是下拉列表中的第二个名称。
Jupyter 中使用的神奇命令(Magic commands used in Jupyter)
Magic commands are special commands that start with one or more % signs, followed by a command. The commands that start with one % symbol are applicable for a single line of code, and those beginning with two % signs are applicable for the entire cell (all lines of code within a cell).
魔法命令是一种特殊命令,以一个或多个 % 符号开头,后面跟一个命令。以一个 % 符号开头的命令适用于一行代码,而以两个 % 符号开头的命令适用于整个单元格(单元格内的所有代码行)。
One commonly used magic command, shown in the following, is used to display Matplotlib graphs inside the notebook. Adding this magic command avoids the need to call the plt.show function separately for showing graphs (the Matplotlib library is discussed in detail in Chapter 7).
一个常用的神奇命令如下所示,用于在笔记本中显示 Matplotlib 图形。添加该神奇命令后,就无需单独调用 plt.show 函数来显示图形了(第 7 章将详细讨论 Matplotlib 库)。
%matplotlib inline
Magic commands, like timeit, can also be used to time the execution of a script, as shown in the following.
魔法命令(如 timeit)也可用于为脚本的执行计时,如下所示。
%%timeit
for i in range(100000):i*i
Output:
16.1 ms ± 283 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)
Now that you understand the basics of using Jupyter notebooks, let us get started with Python and understand the core aspects of this language.
现在,您已经了解了使用 Jupyter 笔记本的基础知识,让我们从 Python 开始,了解这种语言的核心内容。
相关文章:
《Python数据分析技术栈》第01章 02 Jupyter入门(Getting started with Jupyter notebooks)
02 Jupyter入门(Getting started with Jupyter notebooks) 《Python数据分析技术栈》第01章 02 Jupyter入门(Getting started with Jupyter notebooks) Before we discuss the essentials of Jupyter notebooks, let us discuss…...
【征服redis5】redis的Redisson客户端
目录 1 Redisson介绍 2. 与其他Java Redis客户端的比较 3.基本的配置与连接池 3.1 依赖和SDK 3.2 配置内容解析 4 实战案例:优雅的让Hash的某个Field过期 5 Redisson的强大功能 1 Redisson介绍 Redisson 最初由 GitHub 用户 “mrniko” 创建,并在…...
React16源码: React中的beginWork的源码实现
beginWork 1 )概述 在 renderRoot 之后,要对我们的 Fiber 树每一个节点进行对应的更新更新节点的一个入口方法,就是 beginWork这个入口方法会有帮助我们去优化整棵树的更新过程 react 它的节点其实是非常多的,如果每一次子节点的…...
5-微信小程序语法参考
1. 数据绑定 官网传送门 WXML 中的动态数据均来自对应 Page 的 data。 数据绑定使用 Mustache 语法(双大括号)将变量包起来 ts Page({data: {info: hello wechart!,msgList: [{ msg: hello }, { msg: wechart }]}, })WXML <view class"vie…...
数组练习 Leetcode 566.重塑矩阵
在 MATLAB 中,有一个非常有用的函数 reshape ,它可以将一个 m x n 矩阵重塑为另一个大小不同(r x c)的新矩阵,但保留其原始数据。 给你一个由二维数组 mat 表示的 m x n 矩阵,以及两个正整数 r 和 c &#…...
Linux centos中find命令的多种用途:按照具体应用来详细说明find的用法举例
目录 一、find命令 二、find命令的语法 (一)语法格式 (二)选项 1、选项(option)介绍 2、控制符号链接的option 3、调试选项debugopts 4、优化选项 (三)表达式expression 1、选项options 2、测试…...
服务器数据恢复—OceanStor存储raid5热备盘同步数据失败的数据恢复案例
服务器数据恢复环境: 华为OceanStor某型号存储,存储内有一组由24块硬盘组建的raid5阵列,配置1块热备盘。 服务器故障: 该存储raid5阵列中有一块硬盘离线,热备盘自动激活并开始同步数据,在热备盘同步数据的…...
Xline v0.6.1: 一个用于元数据管理的分布式KV存储
Xline是什么?我们为什么要做Xline? Xline是一个基于Curp协议的,用于管理元数据的分布式KV存储。现有的分布式KV存储大多采用Raft共识协议,需要两次RTT才能完成一次请求。当部署在单个数据中心时,节点之间的延迟较低&a…...
【CSS】解决height = line-height 文字不垂直居中(偏上、偏下)的问题
解决办法1: 查看 font-family 属性,确认是否是因为字体而导致的不垂直居中问题。 其他小知识: 基线就是小写x字母的下边缘(线) 就是我们常说的 基线。line-height 属性设置的行高也就是定义的两行文字基线之间的距离! 参考文章:…...
天津想转行学python培训班靠谱吗?
现在的职业如此繁多,很多人把高薪当成衡量工作好坏的重要标准,因此IT行业以超出其他行业几倍薪资水平成为不错的选择,而Python又以其简单易学好上手成为大家所青睐的学习目标。 Python发展前景如何 Python语言就业发展方向广泛:…...
(C语言)冒泡排序
一、运行结果; 二、源代码; # define _CRT_SECURE_NO_WARNINGS # include <stdio.h>//实现buble_sort函数; void buble_sort(int arr[], int sz) {//初始化变量值;int i 0;//嵌套循环冒泡排序;//外层循环&…...
怎么样的布局是符合可制造性的PCB布局?
满足可制造性、可装配性、可维修性要求,方便调试的时候于检测和返修,能够方便的拆卸器件: 1)极性器件的方向不要超过2种,最好都进行统一方向等要求,如图1-1所示; 图1-1 极性器件方向统一摆放 2…...
第28关 k8s监控实战之Prometheus(九)
------> 课程视频同步分享在今日头条和B站 大家好,我是博哥爱运维。早期我们经常用邮箱接收报警邮件,但是报警不及时,而且目前各云平台对邮件发送限制还比较严格,所以目前在生产中用得更为多的是基于webhook来转发报警内容到企…...
安全防御之可信计算技术
可信计算技术是一种计算机安全体系结构,旨在提高计算机系统在面临各种攻击和威胁时的安全性和保密性。它通过包括硬件加密、受限访问以及计算机系统本身的完整性验证等技术手段,确保计算机系统在各种攻击和威胁下保持高度安全和保密性。 一、可信计算基…...
FPGA引脚物理电平(内部资源,Select IO)-认知2
引脚电平 The SelectIO pins can be configured to various I/O standards, both single-ended and differential. • Single-ended I/O standards (e.g., LVCMOS, LVTTL, HSTL, PCI, and SSTL) • Differential I/O standards (e.g., LVDS, Mini_LVDS, RSDS, PPDS, BLVDS, and…...
PBR材质纹理下载
03:10 按照视频里的顺序 我们从第6个网站开始倒数 点击本行文字或下方链接 进入查看 6大网站地址 网址查看链接: http://www.uzing.net/community_show-1962-48-48-35.html 06 Tectures Wood Fence 001 | 3D TEXTURES 简介:最大的纹理网站之一&#x…...
mac PyCharm 使用conda环境
1 使用conda创建虚拟环境 conda create -n test6 python3.9 -y conda activate test62 选择conda环境 本地 选择已经存在的conda环境 右下角会显示现在的环境。...
10个常用的正则表达式
1 电话号码 let r1 /^1[3-9]\d{9}$/g console.log(r1.exec(18596932371)) 2 qq号 let r2 /^[1-9][0-9]{4,9}$/g console.log(r2.exec(123456)) 3 十六进制的方式表示颜色 let r3 /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/g // # 可能可有可无,如果不需要#&a…...
对一手游的自定义 luajit 字节码的研究
对一手游的自定义 luajit 字节码的研究 前言 最近闲下来之后无聊研究起了一个unity手游 大量使用了 lua (或者说就是 lua 写的 ) 看到网上已有的一些针对方案 都觉得太不方便 于是深入研究了一下 他自定义的 luajit 情况研究 首先 这是一个 unity的 传…...
1125. 牛的旅行 (Floyd算法,最短路)
1125. 牛的旅行 - AcWing题库 农民John的农场里有很多牧区,有的路径连接一些特定的牧区。 一片所有连通的牧区称为一个牧场。 但是就目前而言,你能看到至少有两个牧区不连通。 现在,John想在农场里添加一条路径(注意ÿ…...
MATLAB 实现轴承振动信号模拟:从动力学方程到故障仿真
MATLAB matlab 轴承振动信号模拟 轴承动力学方程 滚动轴承动力学模型,轴承动力学模型:滚动轴承运动学模型,深沟球轴承故障基于Hertz接触理论,采用龙格库塔方法可根据需求仿真轴承正常状态,外圈、内圈以及滚动体的故障…...
如何5分钟快速部署Akagi雀魂AI助手:专业实战配置完整指南
如何5分钟快速部署Akagi雀魂AI助手:专业实战配置完整指南 【免费下载链接】Akagi 支持雀魂、天鳳、麻雀一番街、天月麻將,能夠使用自定義的AI模型實時分析對局並給出建議,內建Mortal AI作為示例。 Supports Majsoul, Tenhou, Riichi City, Am…...
2026跨境电商数据采集避坑指南:实测实在Agent如何终结“数字员工”的幻觉时代
【摘要】 2026年3月,跨境电商行业正式迈入“Agent驱动”的生产力新纪元。随着阿里巴巴Accio Work、腾讯云MAGIC Agent 2.0等工具的密集发布,传统基于脚本的爬虫正被具备自主决策能力的“数字员工”取代。然而,在实际业务落地中,通…...
Lab4-Lab: traps MIT6.1810操作系统工程【持续更新】
kernel/trap.c当中是处理所有中断的代码。 RISC-V assembly (简单) 在这个lab当中,要求我们阅读一些汇编代码,并且了解c语言的某些语句对应的汇编是怎样的,同时了解不同寄存器的不同职责(例如ra寄存器是存放返回地址的寄存器…...
PADS VX2.8 极坐标布局技巧:圆形灯板LED高效排列指南
1. 极坐标布局在圆形灯板设计中的核心价值 第一次接触圆形LED灯板设计时,我被密密麻麻的元件排列搞得头晕眼花。传统直角坐标系下,要精确控制每个LED灯珠的间距和角度,需要反复计算XY坐标,效率极低。直到发现PADS VX2.8的极坐标功…...
Pandas读写Parquet文件避坑指南:pyarrow和fastparquet引擎怎么选?columns参数真能省内存吗?
Pandas读写Parquet文件避坑指南:引擎选择与内存优化实战解析 当你第一次听说Parquet格式能比CSV节省80%存储空间时,可能和我一样兴奋地立刻把项目里的数据全转成了.parquet后缀。但真正在生产环境部署时,却发现pd.read_parquet()在不同机器上…...
2025届学术党必备的六大降重复率平台实际效果
Ai论文网站排名(开题报告、文献综述、降aigc率、降重综合对比) TOP1. 千笔AI TOP2. aipasspaper TOP3. 清北论文 TOP4. 豆包 TOP5. kimi TOP6. deepseek 人工智能生成内容也就是AIGC普及之后,文本检测系统变得越来越精密了。为了避免机…...
考研408计算机学科专业基础综合——计算机网络复习
考研408计算机学科专业基础综合 计算机网络复习 核心说明:本笔记聚焦考研408计算机网络高频考点、必背知识点,贴合命题规律(选择题为主、大题集中在核心协议),剔除冗余内容,突出重难点,适配冲刺…...
怎么把webp转换成png?4种方法,新手也能零失误
在日常工作和生活中,webp转换成png挺实用的。比如PNG是无损压缩,还能保留透明背景,做图标、按钮、PPT配图都合适;而WebP虽然压缩效率高、省空间,但很多软件不兼容,像一些老版PS、办公软件,打开W…...
保姆级教程:在Linux上用Flume 1.7.0 + Spark 2.4.7搭建实时日志流处理管道
企业级实时日志处理实战:Flume 1.7.0与Spark 2.4.7深度整合指南 在当今数据驱动的商业环境中,实时日志处理能力已成为企业技术栈的核心竞争力。想象一下电商大促期间每秒数万条的用户行为日志,或是金融交易系统中毫秒级延迟的风控信号处理——…...
