Easy Exploratory Data Analysis (EDA) in Python with Visualization

With Exploratory Data Analysis (EDA) functions in Python, it is easy to get a quick overview of a dataset. The EDA’s goal is the statistical summary and graphical visualization of a dataset. This will help to discover patterns, missing values and help to extract further information for statistical modeling.  The first step in the data … Read more

How to Find Common Elements of Two Lists in Python

Problem Formulation and Solution Overview In this article, you’ll learn how to locate and return the common elements of two (2) lists in Python. To make it more fun, we have the following running scenario: Bondi Brokers offers two (2) Marketable Bonds: 3-years and 5-years. Each yields different amounts. To determine which Bond best suits … Read more

np.argpartition() — A Simple Illustrated Guide

In Python, the numpy.argpartition() function returns the indices that would partition an array along with a given axis based on the specified kth element(s). All elements smaller than the kth element will be moved before it and all larger elements behind it. The element order in the partitions is undefined. If provided with a sequence … Read more

How to Get the Standard Deviation of a Python List?

This article shows you how to calculate the standard deviation of a given list of numerical values in Python. Definition and Problem Formulation The standard deviation is defined as the square root of the variance. In case you’ve attended your last statistics course a few years ago, let’s quickly recap the definition of variance: variance … Read more

np.diff() — A Simple Illustrated Guide

In Python, the numpy.diff() function calculates the n-th discrete difference between adjacent values in an array along with a given axis. For higher-order differences calculation, numpy.diff() runs recursively to the output of the previous execution. Here is the argument table of numpy.diff(): If it sounds great to you, please continue reading, and you will fully … Read more

Resampling A NumPy Array Representing An Image

Overview Resampling a Numpy array means changing the size of the matrix. The most efficient way to resample a numpy array representing an image is using scipy.ndimage.zoom function. The ndarray is the array to resample. The zoom part accepts either a single number or sequence. Inputting a single number implies the image will get zoomed … Read more

How to Apply a Function to NumPy Elements

Problem Formulation and Solution Overview As a Pythonista, coding issues may occur where you need to apply a function against NumPy elements. To make it more fun, we have the following running scenario: We have a NumPy array containing five (5) negative numbers related to an inconsistent inventory count. Therefore, the Vice-President of Rivers Clothing … Read more

Check for NaN Values in Python

Overview Problem: How to check if a given value is NaN? Here’s a quick look at the solutions to follow: So, what is a NaN value? NaN is a constant value that indicates that the given value is Not a Number. It’s a floating-point value, hence cannot be converted to any other type other than … Read more

How to Apply a Function to List Elements

Problem Formulation and Solution Overview As a Pythonista, coding issues may occur where you need to apply a function against array/matrix elements. To make it more fun, we have the following running scenario: The organization Happy Mortgages has six (6) different Mortgage Terms available: 30-Year, 20-Year, 15-Year, 10-Year, 7-Year, and 5-Year terms. The US Federal … Read more

np.reshape() — The Ultimate Guide in Python

Most of the function names in Python can be intuitively connected to the meaning of the function. The NumPy reshape() function is not an exception. The reshape() function brings an array into another shape while keeping all the original data. I’ll demonstrate a couple of simple examples in the following video guide: To summarize how … Read more