vscode查看历史代码_VSCode中数据科学家的四大代码查看器

vscode查看历史代码

动机 (Motivation)

Data science field requires working with data and files in different formats such as YAML, JSON, CSV, and Jupyter Notebook. These formats serve different purposes. There are many of them because each of them has its own pros and cons.

数据科学领域需要使用不同格式的数据和文件,例如YAML,JSON,CSV和Jupyter Notebook。 这些格式用于不同的目的。 它们之所以很多,是因为它们各自都有自己的优缺点。

You might spend hours on trivial tasks such as understanding the content of the json file or making sure you are writing the right yaml code for a list. Luckily, there is a hack for that with VSCode.

您可能需要花费数小时来完成一些琐碎的任务,例如了解json文件的内容或确保为列表编写正确的Yaml代码。 幸运的是,VSCode可以解决此问题。

If you don’t know about VSCode, it is a free source-code editor made by Microsoft for Windows, Linux, and macOS. Two big plus I like about VS Code are keyboard shortcuts and useful extensions.

如果您不了解VSCode ,那就是 Microsoft为Windows,Linux和macOS开发的免费源代码编辑器。 我喜欢VS Code的两个主要优点是键盘快捷键和有用的扩展。

Using VSCode extensions has been a lifesaver. In my last articles, I have covered my 2 favorite extensions:

使用VSCode扩展一直是救生员。 在上一篇文章中,我介绍了我最喜欢的2个扩展:

In this article, I will cover 4 other extensions for viewing files in different formats. These tools have significantly boosted my workflow as a data scientist. Let’s get started!

在本文中,我将介绍其他4个扩展,用于查看不同格式的文件。 这些工具极大地促进了我作为数据科学家的工作流程。 让我们开始吧!

CSV到表格 (CSV to Table)

CSV files are common but hard to read. The common methods to read them are to open a spreadsheet or to use pandas.read_csv(). But either of these methods requires you to either open the notebook or to close your VSCode editor and find the directory where the csv file is at and open the spreadsheet.

CSV文件很常见,但很难阅读。 读取它们的常用方法是打开电子表格或使用pandas.read_csv(). 但是,这两种方法都需要您打开笔记本或关闭VSCode编辑器,然后找到csv文件所在的目录并打开电子表格。

There is a quicker way than that. CSV to Table is an extension to convert your CSV/TSV/PSV files to an ASCII formatted table like below.

有比这更快的方法。 CSV到表格是将CSV / TSV / PSV文件转换为ASCII格式的表格的扩展,如下所示。

Image for post

Now you are only able to view csv file as a well-formatted table but also able to edit the csv file within the table! How cool is that?

现在,您只能以格式正确的表格查看csv文件,还可以在表格中编辑csv文件! 多么酷啊?

To use the extension, install CSV to Table. Type Ctrl + Shift + P then choose CSV: Edit as csv.

要使用扩展名,请将CSV安装到Table。 键入Ctrl + Shift + P然后选择CSV: Edit as csv.

Json编辑器 (Json Editor)

Json is another common format to save data. It might or might not be easier to read the data compared to csv. Json becomes extremely difficult to read when it has a lot of nested objects.

Json是另一种保存数据的常用格式。 与csv相比,读取数据可能更容易,也可能不容易。 当Json有很多嵌套对象时,它变得很难阅读。

If you find yourself looking at the json file for a long time trying to understand its content, Json Editor will be your lifesaver.

如果您发现自己长时间看着json文件试图理解其内容,那么Json Editor将是您的救星。

Image for post

Within Json Editor, you can view the json file in a tree structure like the one on the right screen. Better yet, you could edit the json file within the tree view!

在Json Editor中,您可以以树形结构查看json文件,就像在右侧屏幕上那样。 更好的是,您可以在树视图中编辑json文件!

To use the extension, install JSON Editor. Type Ctrl+Shift+P and type JSON editor: Start JSON editor session. Change the theme in Settings, vscode-json-editor.theme if you want to set either ‘light’ or ‘dark’ theme.

要使用扩展,请安装JSON编辑器。 键入Ctrl+Shift+P并输入JSON editor: Start JSON editor session. 如果要设置“亮”或“暗”主题, vscode-json-editor.theme在“设置” vscode-json-editor.theme更改主题。

YAML (YAML)

Yaml is a human-readable data-serialization language that is commonly used for config files. Yaml is much easier to read and edit than json but it is not always intuitive, especially for beginners, to write yaml properly or to figure out whether yaml indicates a list, a dictionary, or a string.

Yaml是一种人类可读的数据序列化语言,通常用于配置文件。 Yaml比json易于阅读和编辑,但是它并不总是直观,尤其是对于初学者而言,正确编写Yaml或弄清楚yaml是指示列表,字典还是字符串。

But luckily, there is an extension for this called YAML.YAML could do the following:

但是幸运的是,有一个扩展名为YAML.YAML可以执行以下操作:

  • Detects whether the entire file is valid yaml.

    检测整个文件是否为有效Yaml。
Image for post
  • Document Outlining (Ctrl + Shift + O)

    文档大纲(Ctrl + Shift + O)
  • Auto completion (Ctrl + Space)

    自动完成(Ctrl +空格键)
  • Allows for formatting the current file

    允许格式化当前文件
Image for post

With YAML, you can understand the structure of the file, the type of the object, and get access to that object quickly!

使用YAML,您可以了解文件的结构,对象的类型,并快速访问该对象!

Jupyter查看器 (Jupyter Viewer)

Jupyter Notebook is extremely common among data scientists. Even though Jupyter Notebook is useful to analyze the data, you cannot just open a .ipynb file and expect to see it. You need to open a jupyter notebook session by typing jupyter notebook on terminal.

Jupyter Notebook在数据科学家中极为普遍。 即使Jupyter Notebook对分析数据很有用,您也不能只打开.ipynb文件并期望看到它。 您需要通过在终端上键入jupyter notebook来打开jupyter Notebook会话。

This is fine if you expect to work with the notebook for a while. But what if you just want to quickly analyze or visualize the data within VSCode without opening a new session? Luckily, there is an extension for that called Python.

如果您希望在一段时间内使用笔记本电脑,这很好。 但是,如果您只想在不打开新会话的情况下快速分析或可视化VSCode中的数据,该怎么办? 幸运的是,有一个扩展名为Python。

Image for post

I prefer the classic notebook if I expect to use Jupyter Notebook for a while but I will use this if I just want to quickly analyze the data.

如果希望一段时间使用Jupyter Notebook,我会选择经典笔记本,但是如果我想快速分析数据,我会使用它。

To use the extension, simply install the Python extension of Microsoft. Now you can view and edit the notebook without starting a new session!

要使用该扩展,只需安装Microsoft的Python扩展。 现在,您无需启动新会话即可查看和编辑笔记本!

结论 (Conclusion)

Congratulations! You have learned 4 extensions to format VSCode. Being able to format my files has made my life so much easier! I hope you also feel the same after trying with these extensions.

恭喜你! 您已经学习了4种扩展格式,以格式化VSCode。 能够格式化文件使我的生活变得更加轻松! 希望您在尝试这些扩展后也能有同样的感觉。

Star this repo if you want to check out the codes for all of the articles I have written.

如果您想查看我编写的所有文章的代码,请给此回购加注星号。

I like to write about basic data science concepts and play with different algorithms and data science tools. You could connect with me on LinkedIn and Twitter. Follow me on Medium or sign up for my newsletter

我喜欢写有关基本数据科学概念的文章,并喜欢使用不同的算法和数据科学工具。 您可以在LinkedInTwitter上与我联系。 在“ Medium”上关注我或注册我的新闻通讯

to stay informed with my latest data science articles like these:

随时了解我的最新数据科学文章,例如:

翻译自: https://towardsdatascience.com/top-4-code-viewers-for-data-scientist-in-vscode-e275e492350d

vscode查看历史代码

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值