Scatterplot with matplotlib

When you area already familiar with the basic plot from the introduction to matplotlib here is another type of plot used in data science. A very basic visualization is the scatter plot: import numpy as np import matplotlib.pyplot as plt N = 100 x = np.random.rand(N) y = np.random.rand(N) plt.scatter(x, y) plt.show() Color of the…

Python Pipfile and pipenv

  If You already read Python pip and virtualenv you are familiar with the way python handles requirements. but lo and behoild there is a new kid in town or actually two new kids on the block: Pipfile and Pipenv – both with with a capital “P”. If you are tired of creating and maintaining…

Python data classes

A cool new feature made its way into Python 3.7: Data classes. When You’ve already read my article about Lombok the concept isn’t so new at all: With the new decorator @dataclass You can save a huge amount of time because the methods __init__() __repr__() __eq__() are created for you! from dataclasses import dataclass @dataclass…

New Blog Post

numpy random choice

With numpy you can easily create test data with random_integers and randint. numpy.random.randint(low, high=None, size=None, dtype=’l’) numpy.random.random_integers(low, high=None, size=None) random_integers includes the high boundary while randint does not. >>> import numpy as np >>> np.random.random_integers(5) 4 >>> np.random.random_integers(5, size=(5)) array([5, 3, 4, 1, 4]) >>>np.random.random_integers(5, size=(5, 4)) array([[2, 3, 3, 5], [1, 3, 1, 3],…

Linear Algebra with numpy

Numpy is a package for scientific computing in Python. It is blazing fast due to its implementation in C. It is often used together with pandas, matplotlib and Jupyter notebooks. Often these packages are referred to as the datascience stack. Installation You can install numpy via pip pip install numpy Basic Usage In the datascience…

Python pip and virtualenv

After working for a couple of years with Python and external dependencies I’ve ran again and again into the same kind of problems. Bad habits Say you have a global python installation under e.g. C:\Python36 on Windows. When you start working on your first python project you want to use external packages and you encounter…

New Blog Post

Python Type Checking

Python is a dynamically typed language which makes it easy and fun to program. But sometimes -especially in bigger projects- it can become quite cumbersome when you just receive errors at run time. Given the hypothetical example where we define a function which multiplies integer: def multiply(a, b): return a * b print(multiply(“I”, “You”)) It…