This post was written by Rong Lu, a Principal Program Manager working on Data Science tools for Visual Studio Code
Today we’re very excited to announce the availability of Data Science features in the Python extension for Visual Studio Code! With the addition of these features, you can now work with data interactively in Visual Studio Code, whether it is for exploring data or for incorporating machine learning models into applications, making Visual Studio Code an exciting new option for those who prefer an editor for data science tasks.
These features as currently shipping as experimental. We’re starting our Visual Studio Code investments in the data science space with two main use cases in mind:
Now, let’s take a closer look at how Visual Studio Code works in these two scenarios.
Above is an example of a Python file that simply loads data from a csv file and generates a plot that outlines the correlation between data columns. With the new Data Science features, now you can visually inspect code results, including data frames and interactive plots.
A few things to note:
If you have existing Jupyter Notebooks that are ready to be turned into production-ready Python modules, simply bring them into Visual Studio Code by running the command “Python: Import Jupyter Notebook”: this will extract Python code as well as Markdown blocks from the notebook, and put everything into a Python file.
Here is an example of a Jupyter Notebook and the generated Python file. Each code cell becomes a code section with annotation “#%%”, and each Markdown cell turns into a comment section with “#%% [markdown]” annotation. Both cell types are runnable in Visual Studio Code, which means you can reproduce the exact same results that you would see in a Jupyter Notebook.
We’re rolling out these features as experimental in the latest Python extension for Visual Studio Code that shipped today. Please give it a try and let us know what you think by taking a 2-minute survey to help shape the features for your needs.
A quick side note, this is an evolvement from the Visual Studio Code Neuron extension that we worked along with students from Imperial College London this summer. The Neuron extension received a lot of positive feedback just recently, and now we’re taking their awesome work further by building more of such capabilities into the Python extension.
Have fun playing with data in Visual Studio Code!