Microsoft — мировой лидер в области ПО и ИТ-услуг

.NET Core with Jupyter Notebooks Preview 1

Microsoft corporate blogPythonProgramming.NETR
When you think about Jupyter Notebooks, you probably think about writing your code in Python, R, Julia, or Scala and not .NET. Today we are excited to announce you can write .NET code in Jupyter Notebooks.

Try .NET has grown to support more interactive experiences across the web with runnable code snippets, interactive documentation generator for .NET core with dotnet try global tool, and now .NET in Jupyter Notebooks.

Build .NET Jupyter Notebooks

To get started with .NET Notebooks, you will need the following:

Please note: If you have the dotnet try global tool already installed, you will need to uninstall before grabbing the kernel enabled version.

  • Install the .NET kernel

    dotnet try jupyter install
  • Check to see if the .NET kernel is installed 

    jupyter kernelspec list

  • To start a new notebook, you can either type jupyter lab Anaconda prompt or launch a notebook using the Anaconda Navigator.
  • Once Jupyter Lab has launched in your preferred browser, you have the option to create a C# or F# notebook.


The initial set of features we released needed to be relevant to developers, with Notebook experience as well as give users new to the experience a useful set of tools they would be eager to try. Let’s have a look at some of the features we have enabled.

The first thing you will need to be aware of is when writing C# or F# in a .NET Notebook, you will be using C# Scripting or F# interactive.

You can either explore the features listed below locally on your machine or online using the dotnet/try binder image.
For the online documentation, please go to the Docs subfolder located in C# or F# folders.

List of features

Display output : There are several ways to display output in notebooks. You can use any of the methods demonstrated in the image below.

Object formatters : By default, the .NET notebook experience enables users to display useful information about an object in table format.

HTML output : By default .NET notebooks ship with several helper methods for writing HTML. From basic helpers that enable users to write out a string as HTML or output Javascript to more complex HTML with PocketView.

Importing packages : You can load NuGet packages using the following syntax:

#r "nuget:<package name>,<package version>"

For Example

# r "nuget:Octokit, 0.32.0"
# r "nuget:NodaTime, 2.4.6"
using Octokit; using NodaTime; 
using NodaTime.Extensions; 
using XPlot.Plotly; 

Charts with XPlot

Charts are rendered using Xplot.Plotly. As soon as users import XPlot.Plotly namespace into their notebooks(using Xplot.Ploty;), they can begin creating rich data visualizations in .NET.

Please check the .NET Notebook online for more documentation and samples.

.NET Notebooks perfect for ML .NET and .NET for Apache Spark

.NET notebooks bring iterative, interactive experiences popular in the worlds of machine learning and big data to .NET.


ML.NET with Jupyter Notebooks

.NET notebooks open up several compelling scenarios for ML.NET, like exploring and documenting model training experiments, data distribution exploration, data cleaning, plotting data charts, and learning.

For more details on how you can leverage ML.NET in Jupyter notebooks, check out this blog post on Using ML.NET in Jupyter notebooks. The ML.NET team has put together several online samples for you to get started with. 

.NET for Apache Spark

Big Data for .NET

Having notebooks support is indispensable when you are dealing with Big data use cases. Notebooks allow data scientists, machine learning engineers, analysts, and anyone else interested in big data to prototype, run, and analyze queries rapidly.

So how can .NET developers and major .NET shops keep up with our data-oriented future? The answer is .NET for Apache Spark, which you can now use from within notebooks!

Today, .NET developers have two options for running .NET for Apache Spark queries in notebooks: Azure Synapse Analytics Notebooks and Azure HDInsight Spark + Jupyter Notebooks. Both experiences allow you to write and run quick ad-hoc queries in addition to developing complete, end-to-end big data scenarios, such as reading in data, transforming it, and visualizing it.

Option 1: Azure Synapse Analytics ships with out-of-the-box .NET support for Apache Spark (C#).

Option 2: Checkout the guide on the .NET for Apache Spark GitHub repo to learn how to get started with .NET for Apache Spark in HDInsight + Jupyter notebooks. The experience will look like the image below.

Get Started with the .NET Jupyter Notebooks Today!

.NET kernel brings interactive developer experiences of Jupyter Notebooks to the .NET ecosystem. We hope you have fun creating .NET notebooks. Please checkout our repo to learn more and let us know what you build.
Tags:.NET CoreJupyter Notebooksmicrosoft
Hubs: Microsoft corporate blog Python Programming .NET R
1.1k 0
Leave a comment

Popular right now



Habr blog