Skip to main content

Data Science in C#? Yes, we can!

Written by humans, for humans. We don't use AI to write blog posts.

July 22, 2026 Mark Farragher Courses

Did you know you can do a lot of data science work in pure C#? For many things there's no need to switch to python, you can just keep using your favorite programming language.

Analyzing datasets, building machine learning models and running AI algorithms in C# used to be very difficult. There were no easy replacements for Pandas, Numpy, Tensorflow and Matplotlib. Many developers (including me) ended up wrapping python AI code in a webserver and calling the server from C# code. A very brittle solution.

All that changed when Microsoft released the ML.NET framework in 2019. ML.NET is a fully native library for building, training and evaluating machine learning models in C#. The library can also run and fine-tune neural networks built with Tensorflow and tune hyperparameters with Microsoft's AutoML engine.

We have a training course on ML.NET right here on MDFT Pro, if you're interested:

Supervised Machine Learning with C# and ML.NET Access the course here: https://mdftpro.com/course/supervised-machine-learning-csharp-mlnet

Since 2019, the open source community has ported or wrapped many python libraries to bring them to the NET ecosystem. Today in 2026, we have many options besides the ML.NET library:

Python LibraryC# CounterpartType
TensorflowTensorflow.NETNET bindings
KerasKeras.NETNET bindings
PyTorchTorch.NETNET bindings
Scikit-learnScikit-learn.netPure C# port
NumpyNumSharpPure C# port
NumpyNumpy.NETNET bindings
PandasPandas.NETPure C# port
MatplotlibMatplotlib.NetNET wrapper

Numpy.NET is pretty wild, in that it supports pythonic syntax in C# code. You can basically paste python code into a C# editor and get everything working with minimal edits. Take a look at this side-by-side comparison:

C# versus Numpy.NET code

And if you're looking for an alternative to Matplotlib, I am a big fan of Scottplot. We use Scottplot extensively in our Supervised Machine Learning course, and here are just a few examples of chart types you can create with it:

Scottplot

So if you're a data scientist or machine learning engineer, give C# a try. I think you'll be pleasantly surprised by what's possible today without ever touching python.