Jupyter in Visual Studio Code – April 2021 Release

Claudia Regio

We are pleased to announce that the April 2021 release of the Jupyter Extension for Visual Studio Code is now available. If working with Python, we recommend installing the Python extension directly from the extension gallery in Visual Studio Code. If you already have the Python or Jupyter extensions installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about Python support in Visual Studio Code in the documentation.  

This release of the Jupyter Extension includes an overhaul and new functionality of the Data Viewer, as well as some UI enhancements and multiselect support for Native Notebooks.  

If you’re interested, you can check the full list of improvements in our changelog. 

Data Viewer Enhancements 

Upgraded Data Viewer

We’ve added many improvements to our Data Viewer in the latest release. Firstly, we have added the ability to refresh the Data Viewer. If you’ve made some changes or transformations to your data, rather than having to close and reopen the Data Viewer to view the changes, you can now click the refresh button in the top left to grab the most up-to-date data. 

Secondly, the Data Viewer now supports viewing both PyTorch and TensorFlow Tensor data types! 

Finally, we’ve given the entire Data Viewer UI a visual update to make it more aesthetically pleasing. You can now find the filter box at the heading of each column. You can also continue to click on any column heading to sort its data ascending/descending. Lastly, you can now click into individual cells in the Data Viewer to copy out their contents. 

Data Slicing 

Data Slicing

The Data Viewer now has support for slicing data. This will allow you to view any 2D slice of your higher dimensional data. If you have 3-dimensional or greater data (numpy ndarrayPyTorch Tensor or TensorFlow EagerTensor types)you will now be able to view that multi-dimensional data in the Data Viewer and a new data slicing panel will open in the Data Viewer by default. In this panel, you will be able to either use an input box to programmatically specify your slice using Python slice syntax or use the interactive Axis and Index dropdowns to slice as well. Both will be in sync.  

VS Code Insiders – Native Notebooks

To try out Native Notebooks you need to download VS Code Insiders and make sure you have the Jupyter extension! Reminder that the Python extension comes with the Jupyter extension and when working with Python we recommend having both installed for the best Python experience.  

Multiple Cell Selection is Here!  

Jupyter Notebooks now have support for selecting multiple consecutive cells using the mouse (Shift + Click) or the keyboard shortcut (Shift + Arrow) when in cell selection mode.  

Multiselect with Shift

You can also select individual cells using the mouse (Ctrl + Click).  

Multiselect with Ctrl

Once the cells are selected, you can copy/cut/paste/duplicate and even move selected cells by dragging and dropping them to your preferred location.  

Moving Multiselected Cells

Quick Collapse 

You’ll no longer need to open the overflow menu in the cell toolbar to collapse cell inputs or outputs! Simply hover over to the left of each cell and double-click in order to collapse the elements of your cell.  To reveal collapsed content, just click the collapsed icon as shown below. 

Quick Collapse

Customizable Diffing Experience 

Users can now customize the type of information that is surfaced when diffing notebooks and have the option to hide metadata and output differences!  To customize your filters, simply open the overflow menu located in the top right of the rich diff text editor and select the sections on the notebook you would like included!  

Customizable Diffing Content

Other Changes and Enhancements 

We have also added small enhancements and fixed issues requested by users that should improve your experience working with Notebooks in Visual Studio Code. Some notable changes include: 

  • Variable view will stay as long as you have a notebook open (not necessarily active). (#4562) 
  • Ensure extensions depending on Jupyter do not fail to load if Jupyter extension fails to load. (#5145 
  • Fix data viewer display of non-numeric index columns in DataFrames. (#5253) 
  • When reopening a newly created Notebook with a Julia kernel, the cells should be detected as Julia. (#5148) 
  • Support switching kernels in Native Notebooks when connecting to Jupyter. (#1215) 
  • Refactor how Kernels are searched and selected. (#4995) 
  • Be able to provide string argument to jupyter.execSelectionInteractive for extensibility. (Thanks Andrew Craig) (#1689) 

Be sure to have the latest version of the Python and Jupyter Extensions for Visual Studio Code now to try out the above improvements. If you run into any problems or have suggestions, please file an issue on the Jupyter VS Code GitHub repository. 



Discussion is closed. Login to edit/delete existing comments.

  • Jaepil Choi 0

    Sound really promising, thabks for the update!
    Altough, when will be native Jupyter Notebooks shortcuts be available on VSCode’s notebook experience? Like: x to cut, c to copy, v to paste, ctrl shift – to divide cell, etc

    • Joyce ErMicrosoft employee 0

      You can already use x to cut, c to copy, v to paste, and ctrl shift – to split cell in VS Code’s native notebook experience 😊 Simply download VS Code Insiders to try it out. Note that these keybindings work when the cell is in command mode and not edit mode.

      The full list of keybindings provided by the Jupyter extension is available here.

    • Juanjo GA 0

      Very good question … I have been waiting already a couple of months to see the new revamped notebook experience in the stable VS Code build … when will it jump from Insiders to stable???


      • Claudia RegioMicrosoft employee 0

        Hi! We are hoping to get the Native Notebooks experience onto Stable build within the next quarter!

        • Juanjo GA 0

          Thanks for the reply Claudia … Amazing work!!

  • Chensong 0

    Finally another news about Native Notebook!! But I rather wait for it to be released to the stable channel.

  • xi qin 0

    In my data viewer, there are no slicing panel appears. both my VSC and jupyter are Up-to-date. I don’t think it is ‘open in the Data Viewer by default’ in my VSC.

    • Joyce ErMicrosoft employee 0

      The slicing panel only appears for >1D numpy ndarrays and tensors. It is also available as an experimental feature, so if you have opted out of experiments in your user settings.json, for example by setting `”jupyter.experiments.enabled”: false` or `”jupyter.experiments.optOutFrom”: [“All”]`, you will need to either remove those settings or explicitly set `”jupyter.experiments.optInto”: [“jupyterEnhancedDataViewer”]` in order to see the slicing panel appear.

      If the slicing panel still doesn’t appear, please file an issue at https://github.com/microsoft/vscode-jupyter/issues and we’ll be happy to assist.

      • xi qin 0

        I see. Thanks a lot! btw, why don’t you guys put the instruction in the release post?

        • Joyce ErMicrosoft employee 0

          Thanks for the feedback–sounds like you were able to get the slicing feature working. This feature is currently rolled out as an experiment to 100% of users and requires no configuration for users who have not opted out of experiments, which is why we did not include instructions in this blog post. This feature will be available to all users shortly.

  • A Smith 0

    Many thanks for these amazing updates. If I have a pandas dataframe with a multi-index, the VS Code dataframe viewer unfortunately shows one index column that is blank. Would it be possible for this to be fixed?
    For example, if a df has both the fruit_name and date as the index, none of these columns will show in VSCode’s data viewer since it doesn’t like the multi-index.

    apple  2010-01-01    10
           2010-01-02    20

    In VScode dataframe viewer, this df shows as

       index         value
    • Joyce ErMicrosoft employee 0

      Unfortunately we don’t support that yet. Would you mind filing an issue on our repository please? https://github.com/microsoft/vscode-jupyter/issues Thanks for the feedback!

      • A Smith 0

        No worries, I’ll do it in the Python VScode github issues page since it was occurring on .py files too.

        • anonymous 0

          this comment has been deleted.

      • A Smith 0

        Would you know if VScode has an easy way to: add jupyter-style sections to a .py file and then convert the .py file to ipynb?
        I found a way to export to Jupyter using the interactive window. But that would require me to run each .py file, which I’m keen to avoid.

Feedback usabilla icon