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


相关推荐
花酒锄作田1 小时前
Postgres - Listen/Notify构建轻量级发布订阅系统
python·postgresql
Thomas.Sir2 小时前
第二章:LlamaIndex 的基本概念
人工智能·python·ai·llama·llamaindex
m0_694845572 小时前
Dify部署教程:从AI原型到生产系统的一站式方案
服务器·人工智能·python·数据分析·开源
李昊哲小课3 小时前
Python办公自动化教程 - 第7章 综合实战案例 - 企业销售管理系统
开发语言·python·数据分析·excel·数据可视化·openpyxl
不知名的老吴4 小时前
返回None还是空集合?防御式编程的关键细节
开发语言·python
李昊哲小课4 小时前
Python办公自动化教程 - 第5章 图表创建 - 让数据可视化
python·信息可视化·数据分析·数据可视化·openpyxl
chushiyunen4 小时前
python pygame实现贪食蛇
开发语言·python·pygame
Dream of maid4 小时前
Python-基础2(流程控制)
python
Lenyiin5 小时前
《Python 修炼全景指南:一》从环境搭建到第一个程序
开发语言·python
涛声依旧393166 小时前
Python项目实战:学生信息管理系统
开发语言·python·数据挖掘