Python __ceil__() Magic Method

Syntax and Description object.__ceil__(self) The Python __ceil__() method implements the behavior of the math.ceil() function. For example, if you attempt to call math.ceil(x), Python will run the x.__ceil__() method to obtain the return value. We call this a “Dunder Method” for “Double Underscore Method” (also called “magic method”). To get a list of all dunder … Read more

PIP Commands – A Simple Guide

When working with Python, a programmer often encounters situations where she needs to install packages not contained in the Standard Library. In such situations, she must install modules from online repositories using packager installers. The goal of this article is to help beginners develop a working knowledge of pip (acronym for “PIP Installs Packages”) as … Read more

Convert Bytes to String [Python]

[toc] Overview Problem Statement: How to convert bytes data to string data in Python? Example: The following example illustrates how the decode() method converts a byte string to string. (We will dive into the details of this solution soon!) Output: Note: Difference between Byte and String Objects in Python Strings are normal sequences of characters, … Read more

Pandas DataFrame GroupBy and Window – Part 2

The Pandas DataFrame has several Function Applications, GroupBy & Window methods. When applied to a DataFrame, these methods modify the output of a DataFrame. Part 2 of this series focuses on GroupBy & Window methods and delves into each item listed above. Preparation Before any data manipulation can occur, two (2) new libraries will require … Read more

Python __round__() Magic Method

Syntax object.__round__(self, ndigits=0) The Python __round__() method implements the built-in round() function. For example, if you attempt to call round(x) or round(x, ndigits), Python will run the x.__round__() or x.__round__(ndigits) method, respectively. The following code snippet overrides the __round__() dunder method to return the rounded age of a Person when you pass an object of … Read more

Pandas DataFrame Function Application – Part 1

The Pandas DataFrame has several Function Applications, GroupBy & Window methods. When applied to a DataFrame, these methods modify the output of a DataFrame. Part 1 of this series focuses on Function Applications and delves into each of the following methods. Preparation Before any data manipulation can occur, two (2) new libraries will require installation. … Read more

Python __rdiv__ Magic Method

The Python __rdiv__() magic method overrides the reverse division operation for a custom object in Python 2. In Python 3, it was replaced by the __rtruediv__() and __rfloordiv__() dunder methods. The Python __rtruediv__() method is called to implement the normal division operation / called true division and apply it in reverse. The Python __rfloordiv__() method … Read more

How Does the ERC-20 Token Work?

What is an ERC-20 token? An ERC-20 token is a smart contract on Ethereum that implements the methods and events specified in the ERC-20 standard. It is designed to be used as a fungible token, meaning each instance (or unit) of a token has the same value as another instance of the same token. It … Read more

How to Change The Size of Figures Drawn with Matplotlib?

[toc] If you want to dive deep into this mind-blowing library, please feel free to have a look at this tutorial – Matplotlib — A Simple Guide with Videos. However, in this tutorial, we will focus upon our mission-critical question, i.e., How do you change the size of figures drawn with matplotlib? Note: Before diving … Read more