例假来的是黑色的是什么原因| 小孩脚抽筋是什么原因引起的| 美国为什么叫鹰酱| 蚂蚱吃什么食物| 男人硬不起来是什么原因| 长白头发缺什么维生素| 70年产权是什么意思| 仙人掌能治什么病| 左胳膊发麻是什么原因| 受害者是什么意思| 3月2日是什么星座| hpm是什么意思| 水浒传有什么故事| 老年人适合吃什么| 秋五行属什么| 浑身发抖是什么原因| 什么样的梦想| 道理是什么意思| 花容月貌是什么意思| 为什么会做梦中梦| 涅盘是什么意思| 为什么眼皮会一直跳| 渗析是什么意思| 什么是良心| 氪金什么意思| 士字五行属什么| 776是什么意思| 女生左手中指戴戒指什么意思| 吃什么容易怀孕| lam是什么意思| 小儿割包皮挂什么科| 什么是西米| 奠基什么意思| 口腔溃疡吃什么菜| 色达在四川什么地方| 兔唇是什么原因造成的| 不耐受和过敏有什么区别| 治霉菌性阴炎用什么药好得快| 横死是什么意思| 人老是犯困想睡觉是什么原因| pc是什么缩写| 12月20日是什么星座| 6月16号是什么星座| 什么方法可以快速排便| 炒菜什么时候放盐最合适| 李世民是什么民族| belkin是什么牌子| 奥利奥是什么意思| 四月份是什么星座| 榆木脑袋是什么意思| 鱼子酱是什么东西| qq2g在线是什么意思| 冉字五行属什么| 脾肾阳虚吃什么药| 很能睡觉是什么原因| 为什么总是想睡觉| 喜欢吃酸的人是什么体质| 想字五行属什么| 酒店五行属什么| 谷草转氨酶偏低是什么原因| 减肥为什么不让吃茄子| 肛门裂口是用什么药膏| 阴囊长白毛是什么原因| 处女女和什么星座最配| 松茸是什么东西| 我俩太不公平这是什么歌| 肾结石有什么症状| 冰雹是什么季节下的| 疱疹长什么样子图片| 马钧发明了什么| 什么叫处方药| 啤酒是什么酿造的| 螺内酯片是什么药| 神经紊乱会出现什么症状| 安抚是什么意思| 鲁智深的绰号是什么| 男人气血不足吃什么药| 春天有什么特点| 李子有什么功效与作用| 恶风是什么意思| 体检去医院挂什么科| 什么是支原体感染| 无证之罪什么意思| 膺是什么意思| 央行行长什么级别| 三头六臂指什么生肖| 预防脑梗吃什么药| 晕车为什么读第四声| 早上起来心慌是什么原因| 心慌气短胸闷吃什么药| 杨琴是什么乐器| 什么是开放性伤口| 颈椎骨质增生吃什么药效果好| 布吉岛什么意思| 女人吃生蚝有什么好处| 什么偏旁| daddy是什么意思| 地接是什么意思| 85年五行属什么| pct什么意思| 8023什么意思| 口腔溃疡吃什么消炎药| 湿热内蕴是什么意思| 出去旅游需要带什么| 中国最高学历是什么| 女人梦见火是什么预兆| 卷心菜是什么菜| 别开生面什么意思| 芡实是什么| 浆细胞肿瘤是什么病| 叶黄素有什么功效| 异常的异是什么意思| 大便干燥吃什么| 持家是什么意思| 西安香烟有什么牌子| 欢乐海岸有什么好玩的| 高见是什么意思| 肠易激综合征是什么病| 女人梦见蜈蚣预兆什么| 舌头根发麻是什么原因| 饴糖是什么糖| 什么球不能拍| 体寒湿气重喝什么茶好| gda是什么血管| 下午六点是什么时辰| 梦见大蒜是什么意思| 曙光什么意思| 刺梨根泡酒有什么功效| 假性宫缩是什么感觉| 2026年是什么命| 胃炎能吃什么| 见性成佛是什么意思| 钠是什么东西| 血栓吃什么药化得快| 世界上最坚硬的东西是什么| 中医湿气重是什么意思| 囊肿是什么病| 五十而知天命是什么意思| 查心梗应该做什么检查| 血脂高低看什么指标| pt950是什么金| 小伙子是什么意思| 为什么小便会带血| 丹田是什么器官| 女生右手中指戴戒指什么意思| 什么食物含钾高| 强项是什么意思| 静脉曲张吃什么食物| 男性硬不起来什么原因| 办理户口迁移需要什么材料| 拉什么| 扁平疣用什么治疗| 1995属什么生肖| 脂肪肝喝什么茶最好最有效| 一的五行属性是什么| 吃什么缓解孕吐| 舌头上有裂纹是什么原因| 脑瘤是什么原因引起的| 吃什么长内膜最快最有效| 1870年是什么朝代| 空心是什么意思| ccr是什么意思| 玫瑰糠疹是什么病| 榴莲皮可以做什么| 增生性贫血是什么意思| 美业是什么| 前列腺钙化灶是什么病| 糖筛和糖耐有什么区别| 安厝是什么意思| 梦见吃酒席是什么意思| 嗣后是什么意思| 颈椎退行性病变是什么意思| 感光度是什么意思| 1999年属什么| 蛋黄吃多了有什么坏处| 月经为什么来了一点又不来了| 一岁宝宝口臭是什么原因引起的| 感冒为什么会发烧| 肺栓塞有什么症状| 北京大学前身叫什么| 扬代表什么生肖| 小孩子为什么老是流鼻血| 睡觉口干舌燥什么原因| 耳膜破了是什么感觉| 探望病人买什么水果| 他喵的什么意思| 狗属于什么类动物| 梦到公鸡是什么意思| ck是什么| 大理寺是什么机构| 7月30号是什么星座| 贼不走空什么意思| 尼莫地平片治什么病| 水瓶座是什么象| 自在是什么意思| 牙疼吃什么消炎药最好| 头昏脑涨是什么原因| 产值是什么| 12月1日什么星座| 连什么带什么| 发挥失常是什么意思| 受委屈是什么意思| 治便秘什么药最好| 小叶增生和乳腺增生有什么区别| 农历五月初五是什么节| 眼下长斑是什么原因| 落英缤纷是什么意思| 为什么同房后会出血| 秀五行属什么| 鄙人不才是什么意思| 恋童癖是什么意思| 静水流深什么意思| 属猴的守护神是什么菩萨| 乳腺一类是什么意思| 为什么会心肌梗死| 胃出血吃什么药| 旅游的意义是什么| 翡翠跟玉有什么区别| 农字五行属什么| 低压108有什么危险| 额头上长痘是因为什么| 玑是什么意思| 阴宅是什么意思| 热忱是什么意思| 克罗恩病是什么病| 睾丸肿大是什么原因| 甘露醇是什么药| 筋膜是什么| 迪拜货币叫什么| 双侧卵巢多囊样改变是什么意思| 草莓什么时候成熟| 蛤蜊是什么| 舒字五行属什么的| 阳历6月28日是什么星座| 布施什么意思| 什么颜色加什么颜色等于黑色| 铭是什么意思| 为什么会梦到蛇| 立夏什么时候| 钠低会出现什么症状| 跟腱炎挂什么科| 眼睛老跳是什么原因| 口吃什么意思| 处女座和什么座最配对| 肝内胆管结石是什么意思| 测智力去医院挂什么科| 什么叫出轨| 黑茶金花是什么菌| 血糖高吃什么好| 志愿号是什么意思| 右肾盂分离是什么意思| 什么原因导致尿酸高| 晚上睡觉尿多是什么原因| 月经期吃什么好| 太阳是什么颜色的| 阑尾疼吃什么药| 新生儿dha什么时候开始吃| 969368是什么电话| 天天做梦是什么原因| 婴儿八个月可以吃什么辅食| 梦见自己输液是什么意思| 牛仔裤搭配什么鞋| 深情什么意思| 手发麻什么原因| 百度

Try to extend agent mode in VS Code!

2015款Jeep大切洛基最低价优惠15-20万 高端越野

百度 禁令自当日起立即生效。

Jupyter (formerly IPython Notebook) is an open-source project that lets you easily combine Markdown text and executable Python source code on one canvas called a notebook. Visual Studio Code supports working with Jupyter Notebooks natively, and through Python code files. This topic covers the native support available for Jupyter Notebooks and demonstrates how to:

  • Create, open, and save Jupyter Notebooks
  • Work with Jupyter code cells
  • View, inspect, and filter variables using the Variable Explorer and Data Viewer
  • Connect to a remote Jupyter server
  • Debug a Jupyter Notebook

Setting up your environment

To work with Python in Jupyter Notebooks, you must activate an Anaconda environment in VS Code, or another Python environment in which you've installed the Jupyter package. To select an environment, use the Python: Select Interpreter command from the Command Palette (??P (Windows, Linux Ctrl+Shift+P)).

Once the appropriate environment is activated, you can create and open a Jupyter Notebook, connect to a remote Jupyter server for running code cells, and export a Jupyter Notebook as a Python file.

Workspace Trust

When getting started with Jupyter Notebooks, you'll want to make sure that you are working in a trusted workspace. Harmful code can be embedded in notebooks and the Workspace Trust feature allows you to indicate which folders and their contents should allow or restrict automatic code execution.

If you attempt to open a notebook when VS Code is in an untrusted workspace running Restricted Mode, you will not be able to execute cells and rich outputs will be hidden.

Create or open a Jupyter Notebook

You can create a Jupyter Notebook by running the Create: New Jupyter Notebook command from the Command Palette (??P (Windows, Linux Ctrl+Shift+P)) or by creating a new .ipynb file in your workspace.

Blank Jupyter Notebook

Next, select a kernel using the kernel picker in the top right.

Kernel Picker

After selecting a kernel, the language picker located in the bottom right of each code cell will automatically update to the language supported by the kernel.

Language Picker

If you have an existing Jupyter Notebook, you can open it by right-clicking on the file and opening with VS Code, or through the VS Code File Explorer.

Running cells

Run a single code cell

Once your code is added, you can run a cell using the Run icon to the left of the cell and the output will be displayed below the code cell.

Run Jupyter code cell

To run a selected code cell, you can also use keyboard shortcuts in both command and edit mode. Ctrl+Enter runs the currently selected cell. Shift+Enter runs the currently selected cell and inserts a new cell immediately below (focus moves to new cell). Alt+Enter runs the currently selected cell and inserts a new cell immediately below (focus remains on current cell).

Run multiple code cells

Running multiple code cells can be accomplished in many ways. You can use the double arrow in the main toolbar of the Notebook Editor to run all cells within the Notebook or by selecting Run All, Run All Above, or Run All Below above or below the current code cell.

Run multiple code cells

Run cells in section

To more easily run related cells in a notebook, you can run cells that are grouped together by a markdown section header with the Run Cells in Section action. This action is available on the notebook Outline view and for Sticky Scroll elements.

Within Sticky Scroll elements, right-click the header of your choice, and run the section via the action in the context menu. Within the Outline view, select the toolbar icon that appears on hover or selection, and then run a single cell or a section of cells via the presented actions.

Save your Jupyter Notebook

You can save your Jupyter Notebook using the keyboard shortcut Ctrl+S or File > Save.

Export your Jupyter Notebook

You can export a Jupyter Notebook as a Python file (.py), a PDF, or an HTML file. To export, select ... > Export on the main toolbar. You're then presented with a dropdown of file format options.

Convert Jupyter Notebook to Python file

Note: For PDF export, you must have TeX installed. If you don't, you will be notified that you need to install it when you select the PDF option. Also, be aware that if you have SVG-only output in your Notebook, they will not be displayed in the PDF. To have SVG graphics in a PDF, either ensure that your output includes a non-SVG image format or else you can first export to HTML and then save as PDF using your browser.

Work with code cells in the Notebook Editor

The Notebook Editor makes it easy to create, edit, and run code cells within your Jupyter Notebook.

Create a code cell

By default, a blank notebook will have an empty code cell for you to start with and an existing notebook will place one at the bottom. Add your code to the empty code cell to get started.

msg = "Hello world"
print(msg)

Simple Jupyter code cell

Code cell modes

While working with code cells, a cell can be in three states: unselected, command mode, and edit mode. A vertical bar to the left of a code cell and editor border shows the current state of a cell. When no bar is visible, the cell is unselected. When a cell is selected, it can be in command mode or in edit mode.

Unselected Jupyter code cell

In command mode, a solid vertical bar will appear to the left of the cell. The cell can be operated on and accepts keyboard commands.

Code cell in command mode

In edit mode, a solid vertical bar is joined by a border around the cell editor. The cell's contents (code or Markdown) can be modified.

Code cell in edit mode

To switch modes, you can use your keyboard or mouse. On your keyboard, press the Enter key to move to edit mode or the Esc key to move to command mode. With your mouse, click the vertical bar to the left of the cell or out of the code/Markdown region in the code cell.

Add additional code cells

You can add code cells using the main toolbar, a cell's add cell toolbar (visible with hover), and through keyboard commands.

Add code cells

To add a new cell below the currently selected cell, use the plus icon in the main toolbar or a cell's hover toolbar.

When a code cell is in command mode, use the A key to add a cell above and the B key to add a cell below the selected cell.

Select a code cell

You can change a selected code cell using the mouse or the up/down arrow keys on the keyboard. When a code cell is in command mode, you can also use the J key (down) and K key (up).

Select multiple code cells

To select multiple cells, start with one cell in selected mode. A filled background indicates selected cells. To select consecutive cells, hold down the Shift key and click the last cell you want to select. To select any group of cells, hold down the Ctrl key and click the cells you'd like to add to your selection.

Multiselected cells

Move a code cell

You can move cells up or down within a notebook via dragging and dropping. For code cells, the drag and drop area is to the left of the cell editor as indicated below. For rendered Markdown cells, you may click anywhere to drag and drop cells.

Move a code cell

To move multiple cells, you can use the same drag and drop areas in any cell included in the selection.

The keyboard shortcut Alt+Arrow also moves one or multiple selected cells.

Delete a code cell

To delete code, you can use the Delete icon in the code cell toolbar. When the selected code cell is in command mode, you can use the keyboard shortcut dd.

Delete a code cell

Undo your last change

You can use the z key to undo your previous change, for example, if you've made an accidental edit, you can undo it to the previous correct state, or if you've deleted a cell accidentally, you can recover it.

Switch between code and Markdown

The Notebook Editor allows you to easily change code cells between Markdown and code. Selecting the language picker in the bottom right of a cell will allow you to switch between Markdown and, if applicable, any other language supported by the selected kernel.

Change language

You can also use the keyboard to change the cell type. When a cell is selected and in command mode, the M key switches the cell type to Markdown and the Y key switches the cell type to code.

Once Markdown is set, you can enter Markdown formatted content to the code cell.

Raw Markdown displayed in code cell

To render Markdown cells, you can select the check mark in the cell toolbar, or use the keyboard shortcuts Ctrl+Enter and Shift+Enter.

How to render Markdown

Rendered Markdown displayed in code cell

Clear output or restart/interrupt the kernel

If you'd like to clear all code cell outputs or restart/interrupt the kernel, you can accomplish that using the main Notebook Editor toolbar.

Notebook Toolbar

Enable/disable line numbers

When you are in command mode, you can enable or disable line numbering within a single code cell by using the L key.

Line numbers enabled in code cell

To toggle line numbering for the entire notebook, use Shift+L when in command mode on any cell.

Line numbers enabled for notebook

Table of Contents

To navigate through your notebook, open the File Explorer in the Activity Bar. Then open the Outline tab in the Side Bar.

Table of contents

You can use the filter control in the Outline view to include Markdown headers, code cells, and code cell symbols. The filters correspond to the following settings:

  • notebook.outline.showMarkdownHeadersOnly
  • notebook.outline.showCodeCells
  • notebook.outline.showCodeCellSymbols

Note: By default, the outline will only show Markdown. To show code cells, enable the following setting: Notebook > Outline: Show Code Cells.

IntelliSense support in the Jupyter Notebook Editor

The Python Jupyter Notebook Editor window has full IntelliSense – code completions, member lists, quick info for methods, and parameter hints. You can be just as productive typing in the Notebook Editor window as you are in the code editor.

IntelliSense support

Variable Explorer and Data Viewer

Within a Python Notebook, it's possible to view, inspect, sort, and filter the variables within your current Jupyter session. By selecting the Variables icon in the main toolbar after running code and cells, you'll see a list of the current variables, which will automatically update as variables are used in code. The variables pane will open at the bottom of the notebook.

Variable Explorer

Variable Explorer

Data Viewer

For additional information about your variables, you can also double-click a row or use the Show variable in data viewer button next to the variable for a more detailed view of a variable in the Data Viewer.

Data Viewer

Alternatively, you can use the data viewing experience offered by other extensions like Data Wrangler. The Data Wrangler extension offers a rich user interface to show insights about your data and helps you perform data profiling, quality checks, transformations, and more. Learn more about the Data Wrangler extension in our docs.

Filtering rows

Filtering rows in the data viewer can be done by typing in the textbox at the top of each column. Type a string you want to search for and any row that has that string in the column will be found:

Data Viewer

If you want to find an exact match, prefix your filter with '=':

Data Viewer

More complex filtering can be done by typing a regular expression:

Data Viewer

Saving plots

To save a plot from your notebook, simply hover over the output and select the Save icon in the top right.

Save output

Note: There is support for rendering plots created with matplotlib and Altair.

Custom notebook diffing

Under the hood, Jupyter Notebooks are JSON files. The segments in a JSON file are rendered as cells that are comprised of three components: input, output, and metadata. Comparing changes made in a notebook using lined-based diffing is difficult and hard to parse. The rich diffing editor for notebooks allows you to easily see changes for each component of a cell.

You can even customize what types of changes you want displayed within your diffing view. In the top right, select the overflow menu item in the toolbar to customize what cell components you want included. Input differences will always be shown.

Custom notebook diffing

To learn more about Git integration within VS Code, visit Source Control in VS Code.

Debug a Jupyter Notebook

There are two different ways to debug a Jupyter notebook: a simpler mode called "Run by Line", and full debugging mode.

Note: Both of these features require ipykernel 6+. See this wiki page for details about installing or upgrading ipykernel.

Run by Line

Run by Line lets you execute a cell one line at a time, without being distracted by other VS Code debug features. To start, select the Run by Line button in the cell toolbar:

Run by line button

Use the same button to advance by one statement. You can select the cell Stop button to stop early, or the Continue button in the toolbar to continue running to the end of the cell.

Debug Cell

If you want to use the full set of debugging features supported in VS Code, such as breakpoints and the ability to step in to other cells and modules, you can use the full VS Code debugger.

  1. Start by setting any breakpoints you need by clicking in the left margin of a notebook cell.
  2. Then select the Debug Cell button in the menu next to the Run button. This will run the cell in a debug session, and will pause on your breakpoints in any code that runs, even if it is in a different cell or a .py file.
  3. You can use the Debug view, Debug Console, and all the buttons in the Debug Toolbar as you normally would in VS Code.

Note that debugging cells in a jupyter notebook does not use any of the debug configurations in launch.json. It can be customized instead via settings such as jupyter.debugJustMyCode.

Debug cell button

Search through notebook

You can search through a notebook (or parts of it by filtering the search options) by using the keyboard shortcut Ctrl/Cmd + F. Click the Filter option (funnel icon) to search across:

  • Markdown cell input (Markdown Source)
  • Markdown cell output (Rendered Markdown)
  • Code cell input (Code Cell Source)
  • Code cell output (Cell Output)

Notebook searches are filtered cell inputs only by default.

Search options

Connect to a remote Jupyter server

You can offload intensive computation in a Jupyter Notebook to other computers by connecting to a remote Jupyter server. Once connected, code cells run on the remote server rather than the local computer.

To connect to a remote Jupyter server:

  1. Open the Kernel Picker button on the top right-hand side of the notebook (or run the Notebook: Select Notebook Kernel command from the Command Palette).

    Notebook kernel picker

  2. Select the Existing Jupyter Server option to connect to an existing Jupyter server.

    Select existing Jupyter server

  3. To connect to an existing server for the first time, select Enter the URL of the running Jupyter server.

    Choose to connect to an existing server

  4. When prompted to Enter the URL of the running Jupyter server, provide the server's URI (hostname) with the authentication token included with a ?token= URL parameter. (If you start the server in the VS Code terminal with an authentication token enabled, the URL with the token typically appears in the terminal output from where you can copy it.) Alternatively, you can specify a username and password after providing the URI.

    Prompt to supply a Jupyter server URI

Note: For added security, Microsoft recommends configuring your Jupyter server with security precautions such as SSL and token support. This helps ensure that requests sent to the Jupyter server are authenticated and connections to the remote server are encrypted. For guidance about securing a notebook server, refer to the Jupyter documentation.

Data Science profile template

Profiles let you quickly switch your extensions, settings, and UI layout depending on your current project or task. To help you get started with Jupyter Notebooks, you can use the Data Science profile template, which is a curated profile with useful extensions, settings, and snippets. You can use a profile template as is or use it as a starting point to customize further for you own workflows.

You select a profile template through the Profiles > Create Profile... dropdown:

Create Profile dropdown with profile templates

Once you select a profile template, you can review the settings and extensions, and remove individual items if you don't want to include them in your new profile. After creating the new profile based on the template, changes made to settings, extensions, or UI are persisted in your profile.

今年43岁属什么 头不自觉的晃动是什么原因 甲状腺低回声结节是什么意思 被紫外线灯照到有什么后果呀 金字旁加者念什么
bv是什么牌子 泰坦尼克号女主角叫什么 什么的双手 喝什么水去火 非处方药是什么意思
鸾凤是什么意思 股骨头坏死什么症状 什么生活 靠谱什么意思 什么零食热量低有利于减肥
胃不好适合吃什么水果 农历十二月是什么月 全麻对身体有什么影响 玉屏风治什么病最好 三碘甲状腺原氨酸高是什么意思
乳头状瘤是什么病dajiketang.com 脖子上长痘痘什么原因hcv9jop5ns6r.cn 和尚命是什么意思hcv9jop2ns7r.cn 隆科多为什么不姓佟baiqunet.com 中暑了喝什么hcv9jop0ns1r.cn
叫花子是什么意思hcv7jop9ns8r.cn 脘腹胀满是什么意思hcv9jop5ns0r.cn 里程是什么意思hcv8jop1ns9r.cn 民营企业和私营企业有什么区别hcv9jop5ns9r.cn 赶集是什么意思hcv8jop2ns3r.cn
空调不热是什么原因hcv9jop5ns8r.cn 早饭吃什么好hcv7jop4ns7r.cn 些几 是什么意思clwhiglsz.com 我们到底什么关系zsyouku.com 翰字五行属什么hcv8jop3ns1r.cn
什么病不能吃松花粉hcv7jop5ns6r.cn 什么蛋不能吃脑筋急转弯hcv7jop5ns2r.cn 液氨是什么jingluanji.com fdg是什么意思hcv9jop4ns2r.cn 鱼鳔是什么东西hcv8jop0ns3r.cn
百度