Visual Studio Code for Data Science —高级用户指南

The quintessential IDE?

最典型的IDE?

Visual Studio Code
Visual Studio Code on Wikipedia Wikipedia上的Visual Studio Code

Microsoft’s Visual Studio Code is arguably one of the best IDEs for developers. The same is true for Data Scientists. There are numerous tools and extensions in the VS Code that enable users with great user experience.

中号 icrosoft的Visual Studio代码可以说是开发商最好的IDE之一。 数据科学家也是如此。 VS Code中有许多工具和扩展,可为用户提供出色的用户体验。

建立 (Setup)

Install the Python for VS Code extension

安装Python for VS Code扩展

For R, install R extension

对于R,请安装R扩展名

Environments

环境环境

Often, you will require packages and modules that are not available by default installation. Some libraries or applications specify a particular version of a library to be used. Virtual environments are useful in these cases.

通常,您将需要默认安​​装中不可用的软件包和模块。 一些库或应用程序指定要使用的库的特定版本。 在这些情况下,虚拟环境很有用。

You can setup Python using Python distributions using Anaconda.

您可以使用Anaconda使用Python发行版设置Python。

To manage your environment, in VS Code, you can select an environment of your choice from the Command Palette ( ⇧⌘P ) > Python: Select Interpreter.

要管理您的环境,可以在VS Code中从“命令面板”( P )>“ Python”中选择所需的环境:选择“解释器”

Image for post
Python: Select Interpreter
Python:选择解释器
Image for post
Selecting a Python environment
选择一个Python环境

Workspaces

工作空间

Workspace Settings are stored inside your workspace and only apply when the workspace is opened. They override the global user settings. This way each of the Data Science workspaces can be custom configured.

工作区设置存储在您的工作区中,并且仅在打开工作区时适用。 它们将覆盖全局用户设置。 这样,可以自定义配置每个Data Science工作区。

Jupyter笔记本 (Jupyter Notebooks)

Image for post
Jupyter
朱皮特

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text.

Jupyter Notebook是一个开源Web应用程序,允许您创建和共享包含实时代码,方程式,可视化效果和叙述文本的文档。

Developed as a successor to IPython with REPL (Read-Evaluate-Print-Loop) shell, Jupyter Notebooks are the computational notebook of choice for Data Science.

Jupyter Notebooks是具有REPL(读取-评估-打印循环)外壳的IPython的后继产品,是数据科学的首选计算笔记本。

The Jupyter extension is not being maintained currently, and the Python plugin from Microsoft officially includes native support for Jupyter Notebooks.

目前尚未维护Jupyter扩展,Microsoft的Python插件正式包含对Jupyter Notebook的本地支持。

Install Jupyter

安装Jupyter

Install Jupyter in your workspace using pip install jupyter

使用pip install jupyter在您的工作区中pip install jupyter

To create a new Jupyter notebook — use the Command Palette ( ⇧⌘P ) > Create New Blank Jupyter Notebook.

要创建新的Jupyter笔记本,请使用命令面板( ⇧⌘P )> 创建新的空白Jupyter笔记本。

Image for post
Open a new Jupyter Notebook
打开一个新的Jupyter Notebook

The Jupyter server will be set to local, and a python kernel is selected based on your workspace settings.

Jupyter服务器将设置为本地,并根据您的工作区设置选择一个python内核。

Image for post
Jupyter Notebook toolbar
Jupyter Notebook工具栏

扩展名 (Extensions)

Extensions are an integral part of the Visual Studio Code experience for developers. They range from visual effects to integration with other services. You can modify your interface as much as you wish to enhance productivity, for example —Bracket Pair Colorizer helps you find that one missing or extra bracket with colors, or Trailing spaces can help you find the extraneous spaces, which is really helpful in python.

对于开发人员来说,扩展是Visual Studio Code体验不可或缺的一部分。 它们的范围从视觉效果到与其他服务的集成。 您可以根据需要修改界面,以提高工作效率,例如-括号对着色器可帮助您找到一个缺少的或带有颜色的括号,或者尾随空格可以帮助您找到多余的空格,这在python中确实非常有用。

For a list of extensions that can improve your experience on Visual Studio Code, I found the following medium post really helpful.

有关可以改善您在Visual Studio Code上的使用体验的扩展列表,我发现以下中等经验确实有用。

Some of the extensions include:

一些扩展包括:

  • Trailing spaces

    尾随空格
  • Bracket Matching

    支架匹配
  • GitLens

    吉特伦斯
  • Sublime Text KeyMap

    崇高文本KeyMap
  • Intellisense

    智能感知

综合终端 (Integrated terminal)

Image for post
Integrated Terminal
综合终端

Visual Studio has an integrated terminal, that starts at the root space by default.

Visual Studio有一个集成终端,默认情况下从根空间开始。

To open the terminal:

要打开终端:

  • Use the ( ⌃` ) keyboard shortcut with the backtick character.

    使用( ⌃` )键盘快捷键和反引号字符。

  • Use the View > Terminal menu command.

    使用查看>终端菜单命令。
  • From the Command Palette ( ⇧⌘P ), use the View: Toggle Integrated Terminal command.

    在命令面板( ⇧⌘P )中,使用“查看:切换集成终端”命令。

Managing multiple terminals

管理多个终端

Terminal instances can be added by clicking the plus icon on the top-right of the TERMINAL panel or by triggering the ( ⌃⇧` ) command.

可以通过单击TERMINAL面板右上角的加号图标或触发( ⌃⇧` )添加终端实例。 命令。

Split terminals

分体式端子

You can also split the terminal by triggering the ( ⌘\ ) command or via the right-click context menu.

您也可以通过触发( ⌘\ )分割终端 命令或通过右键单击上下文菜单。

版本控制 (Version Control)

Git
unDraw

Version control is essential for any developer or project, helping facilitate working on different modules and versions by across teams. Git, the distributed version control system for tracking changes in your source code is neatly integrated into Visual Studio Code.

版本控制对于任何开发人员或项目都是必不可少的,有助于跨团队使用不同的模块和版本。 Git是用于跟踪源代码更改的分布式版本控制系统,它巧妙地集成到了Visual Studio Code中。

Git in VS Code
Git History (git log)
Git历史记录(git日志)

To get started with Git on VS Code, download and install the official extension names — GitHub Pull Requests and Issues. Or you can install the extension GitLens. GitLens helps you to visualize code authorship via Git blame annotations and code lens, and navigate and explore Git repositories.

要在VS Code上开始使用Git,请下载并安装官方扩展名-GitHub Pull Requests and Issues 。 或者,您可以安装扩展名GitLens 。 GitLens可帮助您通过Git责备注释和代码镜头可视化代码作者,并浏览和浏览Git存储库。

Follow me on LinkedIn and GitHub, or visit my website at rohithsajja.me

LinkedInGitHub上关注我,或访问rohithsajja.me网站

翻译自: https://medium.com/dataseries/visual-studio-code-for-data-science-the-power-users-guide-3a20b8630a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值