国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Python數(shù)據(jù)分析JupyterNotebook3魔法命令詳解及示例

瀏覽:31日期:2022-06-04 15:36:13
目錄
  • 1、魔法命令介紹
    • %lsmagic:列出所有magics命令
    • %quickref:輸出所有魔法指令的簡(jiǎn)單版幫助文檔
    • %Magics_Name?:輸出某個(gè)魔法命令詳細(xì)幫助文檔
  • 2、Line magics:Line魔法指令
    • 3、Cell magics:Cell魔法指令
      • 寫bash程序
      • 寫perl程序

    1、魔法命令介紹

    %lsmagic:列出所有magics命令

    Available line magics:【對(duì)當(dāng)前行使用共計(jì)93個(gè)】%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:【對(duì)當(dāng)前cell使用共計(jì)28個(gè)】%%!  %%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

    %quickref:輸出所有魔法指令的簡(jiǎn)單版幫助文檔

    %Magics_Name?:輸出某個(gè)魔法命令詳細(xì)幫助文檔

    魔法命令名稱?輸出魔法命令的詳細(xì)幫助文檔,以%alias為例:

    2、Line magics:Line魔法指令

    %alias:設(shè)置指令的別名

    windows有8個(gè)默認(rèn)的指令,功能和linux下一樣。

    #Windows下有8個(gè)命令I(lǐng)n [1]: %alias#Total number of aliases: 8Out[1]:[("copy", "copy"), ("ddir", "dir /ad /on"), ("echo", "echo"), ("ldir", "dir /ad /on"),#列出文件夾 ("ls", "dir /on"), ("mkdir", "mkdir"),#創(chuàng)建文件夾 ("ren", "ren"), ("rmdir", "rmdir")]#刪除文件夾

    Linux下有16個(gè)默認(rèn)指令,感興趣可自己試驗(yàn)。

    In [3]: %aliasTotal number of aliases: 16Out[3]:[("cat", "cat"), ("clear", "clear"), ("cp", "cp"), ("ldir", "ls -F -o --color %l | grep /$"), ("less", "less"), ("lf", "ls -F -o --color %l | grep ^-"), ("lk", "ls -F -o --color %l | grep ^l"), ("ll", "ls -F -o --color"), ("ls", "ls -F --color"), ("lx", "ls -F -o --color %l | grep ^-..x"), ("man", "man"), ("mkdir", "mkdir"), ("more", "more"), ("mv", "mv"), ("rm", "rm"), ("rmdir", "rmdir")]

    自己設(shè)置指令的別名,個(gè)人感覺沒啥意義,介紹一個(gè)。

    %conda:cell中安裝packageM

    %conda install package_names

    %dhist:輸出歷史訪問目錄

    %history:列出歷史輸入的指令

    效果類似linux中history。

    %magic:輸出所有魔法指令幫助文檔

    %matplotlib inline:效果等價(jià)于plt.show()

    %notebook:導(dǎo)出當(dāng)前notebook所有歷史輸入到一個(gè)文件中

    %notebook notebook.ipynb將所有歷史輸入導(dǎo)入notebook.ipynb文件中

    %pip:在cell中使用pip指令

    %pwd:輸出當(dāng)前路徑

    %pycat:預(yù)覽文件,類似linux中cat

    %run:執(zhí)行腳本

    %time:執(zhí)行時(shí)間

    3、Cell magics:Cell魔法指令

    %%writefile:將當(dāng)前cell中內(nèi)容寫入文件中

    %%latex:寫Latex公式

    %%latex\begin{equation}  \int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}  \label{eq:sample}\end{equation}

    %%script :寫bash、perl、javascript、js 等命令

    這個(gè)可以使用bash、perl、javascript、js 等等,不過經(jīng)過測(cè)試,在jupyter notebook中不友好,在ipython中沒什么問題。

    以下在ipython中完成:

    寫bash程序

    In [9]: %%script bash   ...: for i in 1 2 3; do   ...: echo $i;   ...: done123

    寫perl程序

    In [11]: %%script perl    ...: print "hhn";hhn

    寫python2程序

    In [12]: %%script python2    ...: print "hhhn"    ...:    ...:hhhn

    參考資料:https://ipython.readthedocs.io/en/stable/interactive/magics.html#

    以上就是JupyterNotebook3魔法命令詳解及示例的詳細(xì)內(nèi)容,更多關(guān)于JupyterNotebook3魔法命令的資料請(qǐng)關(guān)注其它相關(guān)文章!

    標(biāo)簽: ASP Python 編程語(yǔ)言
    相關(guān)文章:
    主站蜘蛛池模板: 亚洲视频三区 | 亚洲男人天| 精品一区二区影院在线 | 久久99精品视频在线在线观看 | 欧美视频在线网站 | 美女张开腿黄网站免费 | 看三级网站| 69成人做爰视频在线观看 | 久草手机在线播放 | 日本三级2021最新理论在线观看 | a级毛片免费在线观看 | 国产欧美日韩精品第二区 | 国产欧美一区二区三区视频在线观看 | 免费播放aa在线视频成人 | 性a爱片免费视频性 | 一本一道久久综合狠狠老 | 九九99久久精品国产 | 久久国产经典视频 | 九月婷婷亚洲综合在线 | a三级黄色片 | 日本一区二区三区在线 视频观看免费 | 国产欧美va欧美va香蕉在线 | 精品亚洲视频在线观看 | 国产a自拍| 午夜精品在线 | 99在线精品视频在线观看 | 免费国产成人高清在线观看视频 | 亚洲精品国产精品国自产观看 | 992人人tv香蕉国产精品 | 给我一个可以看片的www日本 | 亚洲视频在线观 | 99热官网 | 91久久国产露脸精品免费 | 黄色一级毛片免费 | 成人在线手机视频 | 久久在线影院 | 久草视频免费 | 国产a精品三级 | 久久福利青草免费精品 | 亚洲精品一区二区三区四区手机版 | 国产一级性片 |