[Tutorial] How to Get the Row with Minimal Variance in One Line of Python Code

You may have read about the β€˜V’s in Big Data: Volume, Velocity, Variety, Veracity, Value, Volatility. Variance is yet another important β€˜V’ (it measures Volatility of a data set). In practice, variance is an important measure with important application domains in financial services, weather forecasting, and image processing. Variance measures how much the data spreads …

[Tutorial] How to Get the Row with Minimal Variance in One Line of Python Code Read More »

K-Nearest Neighbors as a Python One-Liner

The popular K-Nearest Neighbors Algorithm is used for regression and classification in many applications such as recommender systems, image classification, and financial data forecasting. It is the basis of many advanced machine learning techniques (e.g. in information retrieval). There is no doubt that understanding KNN is an important building block of your proficient computer science …

K-Nearest Neighbors as a Python One-Liner Read More »

[NumPy] How to Calculate Basic Statistics Along an Axis? (avg, var, std)

This article explains how to calculate basic statistics (average, standard deviation, and variance) along an axis. We use the NumPy library for linear algebra computations. These three ways are very similar — if you understand one of them, you’ll understand all of them. Graphical Explanation Here’s what you want to achieve: Extracting basic statistics from …

[NumPy] How to Calculate Basic Statistics Along an Axis? (avg, var, std) Read More »

Overloading Overwriting

Method Overriding vs Overloading in Python [+Video]

Method overloading: allowing different parameters for calling the same method Method overriding: overwriting the functionality of a method defined in a parent class. Here is an example for Method overloading: What’s the output of this code? The class Wizard defines an instance attribute ‘mana’ that represents the energy level of the respective Wizard instance. If …

Method Overriding vs Overloading in Python [+Video] Read More »

Underscore Python

The Single and Double Underscore in Python [“_” vs “__”]

The single underscore in Python “_” is used to either make a variable different from a Python keyword (e.g. “float_=8”), or to indicate that it should be used in a private context (e.g. “_var=8”). The double underscore “__” (called “dunder“) is used to make an instance attribute or method private (cannot be accessed from outside …

The Single and Double Underscore in Python [“_” vs “__”] Read More »

Python Attributes

Class and Instance Attributes in Python — Every Coder Must Know the Difference! [+Video Guide]

Today, you are going to learn about the terminology of “attributes” because you need to understand the term and the concepts behind the term to be able to master more advanced stuff. There are two types of attributes: class attributes and instance attributes. Class attributes are variables that are defined for the class itself. Instance …

Class and Instance Attributes in Python — Every Coder Must Know the Difference! [+Video Guide] Read More »

Python Objects Classes Example

A Simple Example for Python Objects and Classes [+Video]

In Python, everything is an object. Even integer values are objects — this is different from programming languages like Java where integers, floats, and booleans are primitive data types. In this way, Python is built on a rigorously consistent object-oriented paradigm. For an ultra-short Python object orientation tutorial, check out the following Instagram post (swipe …

A Simple Example for Python Objects and Classes [+Video] Read More »

Static and Dynamic Attributes in Python – What’s the Difference?

Let’s play with some code first to answer this question: You can also watch my explainer video while you read through the remaining article: By studying this question, you will improve your understanding of not only the fine details but also of the whole picture “object-oriented programming”. So, let’s start by answering the two questions: …

Static and Dynamic Attributes in Python – What’s the Difference? Read More »