Numpy

Recently, I published a small example project to utilize the htm.core AI algorithm by consuming its REST API via C#. As the API also transfers serialized multi-dimensional NumPy arrays, I was looking for an easy way to get them back into C# objects. I’ve tried out a couple of approaches and finally decided on using the NumSharp library, as I wanted a solution that works on multiple platforms.

Numpy

You need to understand NumPy before you can thrive in data science and machine learning. The topics of this cheat sheet are creating arrays, combining arrays, scalar math, vector math and statistics. This is only one great NumPy cheat sheet—if you want to get more, check out our article on the 10 best NumPy cheat sheets! NumPy Cheat Sheet: Data Analysis in Python This Python cheat sheet is a quick reference for NumPy beginners. Given the fact that it's one of the fundamental packages for scientific computing, NumPy is one of the packages that you must be able to use and know if you want to do data science with Python.

I find DataCamps’ Data Science Cheat Sheets very useful and was hoping to find something similar for NumSharp. Well, I didn’t, but obviously that gave me a good reason to just compile one myself.

Sheet

So using the original DataCamps’ NumPy Cheat Sheet as foundation, let me introduce the freshly created NumSharp Cheat Sheet:

As you will notice, some stuff from the original cheat sheet is missing. That’s mainly because not all NumPy functionality has been ported yet. However, if I missed something important, please let me know.

Interactive Notebook

Besides the NumSharp Cheat Sheet itself, I also created a dotnet interactive notebook, which allows you to play around with NumSharp directly in your web-browser. Just click on the binder launch icon below to start it up (might take some time, so please be patient).

Notebook notes

Before you play around with the notebook, please ensure that you always run the top two cells first.

Numpy functions cheat sheet free

The first cell installs the NumSharp package via NuGet, and the second one makes is available to the other cells.

Output Format

Using the interactive C# notebook, NDArray variables are printed in a tabular, pandas like format, per default.

To mimic the output format of the NumPy Cheat Sheet, just use the ToString() method, as shown above.

Workarounds

As mentioned earlier, some functionality of NumPy is not ported to NumSharp. The jupyter notebook shows a possible workaround for the element-wise comparison with the < and > operators, for example.

If you are aware of workarounds for any of the other missing functions/methods, please feel free to contribute to the NumSharp Cheat Sheet interactive notebook GitHub project.

Numpy Functions Cheat Sheet

Scipy Cheat Sheet Pdf

That’s it again for now. Have a great time and happy coding!

Numpy Functions Cheat Sheet Pdf

5