Jupyter 初试

jupyter notebook learning

a very simple operation

Let’s add two numbers

1+2
3

Counter

Let’s count from 0 to 4

for i in range(6):
    print(i)
0
1
2
3
4
5

plot y = x^2

%matplotlib inline
%config InlineBackend.figure_format = 'svg' # 渲染矢量图使图片更加清晰
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(20)
y=x**(2)
plt.plot(x,y)
[<matplotlib.lines.Line2D at 0x26d760a5208>]

在这里插入图片描述




魔法指令查询

%lsmagic
Available line magics:
%alias  %alias_magic  %autoawait  %autocall  %automagic  %autosave  %bookmark  %cd  %clear  %cls  %colors  %conda  %config  %connect_info  %copy  %ddir  %debug  %dhist  %dirs  %doctest_mode  %echo  %ed  %edit  %env  %gui  %hist  %history  %killbgscripts  %ldir  %less  %load  %load_ext  %loadpy  %logoff  %logon  %logstart  %logstate  %logstop  %ls  %lsmagic  %macro  %magic  %matplotlib  %mkdir  %more  %notebook  %page  %pastebin  %pdb  %pdef  %pdoc  %pfile  %pinfo  %pinfo2  %pip  %popd  %pprint  %precision  %prun  %psearch  %psource  %pushd  %pwd  %pycat  %pylab  %qtconsole  %quickref  %recall  %rehashx  %reload_ext  %ren  %rep  %rerun  %reset  %reset_selective  %rmdir  %run  %save  %sc  %set_env  %store  %sx  %system  %tb  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmode

Available cell magics:
%%!  %%HTML  %%SVG  %%bash  %%capture  %%cmd  %%debug  %%file  %%html  %%javascript  %%js  %%latex  %%markdown  %%perl  %%prun  %%pypy  %%python  %%python2  %%python3  %%ruby  %%script  %%sh  %%svg  %%sx  %%system  %%time  %%timeit  %%writefile

Automagic is ON, % prefix IS NOT needed for line magics.

魔法指令测试

%time 
for x in range(100):
    for y in range(1000):
        pass
Wall time: 0 ns
%%timeit a=range(10)min(a)
UsageError: %%timeit is a cell magic, but the cell body is empty. Did you mean the line magic %timeit (single %)?

jupyter 快捷键记录

命令模式下的常用快捷键

  • a / b (在活跃单元格(之上/之下)) 插入一个新的单元

  • dd 删除一个单元格

  • Ctrl+d 清空单元格

  • Shift+ ↑↓可以选择多个单元,按Shift+M 合并这些单元啊

  • (m/y) MarkDown 模式/代码模式

编辑模式下常用快捷键

  • Ctrl + S 保存进度

  • Ctrl + Enter 运行代码

  • Alt + Enter 运行并在下方添加单元格

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值