Jupyter Notebook魔术命令

Jupyter Notebook是一个基于网页的交互式笔记本,支持运行多种编程语言。

Jupyter Notebook 的本质式一个Web应用程序,便于创建和共享文学化程序文档,支持实现代码,数学方程,可视化和markdown。用途包括:数据清理和转换,数值模拟,统计建模,机器学习等。

1、%timeit 检测任意python语句的执行时间

python 复制代码
%timeit [x**3 for x in range(1000)]

2、%matplotlib inline 画图显示在页面

python 复制代码
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

data = np.arange(20)
plt.plot(data**2)

3、%pwd 显示当前目录

python 复制代码
%pwd

4、%run python文件

python 复制代码
%run test_run.py


相关推荐
Warson_L6 小时前
Python `Annotated` 与 LangGraph Reducer 学习笔记
python
韩师傅6 小时前
海天线算法的前世今生
python·计算机视觉
韩师傅6 小时前
当你的甲方设备过烂,要如何快速出效果?
python·计算机视觉
Warson_L6 小时前
LangGraph的MessageState and HumanMessage
python
韩师傅6 小时前
当你的甲方吐槽天空不够蓝,你应该如何应对
python·计算机视觉
Warson_L7 小时前
python的类&继承
python
Warson_L7 小时前
类型标注/type annotation
python
ThreeS9 小时前
手搓MiniVLA全实战教程-一步一步用pytorch解释原理与思路
人工智能·python
金銀銅鐵11 小时前
[Python] 模 n 乘法的逆元计算器
python·数学·游戏