How to Index Elements in NumPy Arrays?

NumPy is a popular Python library for data science for array, vector, and matrix computations. This puzzle introduces basic indexing of elements in NumPy arrays. Problem Formulation: How to index elements in NumPy arrays? Indexing 1D Arrays with Positive Indices The most simple use of indexing is with the square bracket notation and positive integers: … Read more

How to Calculate the Standard Deviation in NumPy?

Problem Formulation: How to calculate the standard deviation in NumPy? Differentiations: There are many different variants of this problem: Calculate the standard deviation of a 1D array Calculate the standard deviation of a 2D array Calculate the standard deviation of a 3D array Then you can also calculate the standard deviation along an axis: Calculate … Read more

How to Calculate Percentiles in Python

This article deals with calculating percentiles. Percentiles are statistical indicators that are used to describe specific portions of a sample population. The following sections will explain what percentiles are, what they are used for and how to calculate them, using Python. As you will see, Python allows solving this problem in multiple ways, either by … Read more

Logistic Regression Scikit-learn vs Statsmodels

What’s the difference between Statsmodels and Scikit-learn? Both have ordinary least squares and logistic regression, so it seems like Python is giving us two ways to do the same thing. Statsmodels offers modeling from the perspective of statistics. Scikit-learn offers some of the same models from the perspective of machine learning. So we need to … Read more

How to Index 1D NumPy Arrays?

Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. Problem Formulation: Given a one-dimensional NumPy array arr. How to access the i-th value in the array? How to access all values between the i-th value (included) and the j-th value (excluded) from the array? How to access all values … Read more

The K-Means Algorithm in Python

Hey Finxters! Today we are going to talk about one of the most popular clustering algorithms: K-Means. Ever wondered how to organize seemingly unstructured data, making sense of unordered objects, in an easy way? For example, you might need to: perform customer segmentation store files based on their text content compress images with your own … Read more

How to Fix “TypeError: len() of unsized object”

Problem Formulation: How to fix the TypeError: len() of unsized object? TypeError: len() of unsized object There are many possible ways why this array may occur. One common pitfall is to use the len() function on a NumPy array with only one value. Example: Let’s consider the minimal example that creates this error message! Reason … Read more

TensorFlow — A Helpful Illustrated Guide

Machine Learning (ML) is a sought-after skill in today’s automated world. Google is one of the key players in the Machine Learning space. With the growing scale and popularity of deep learning, the limitations of a single machine become more and more pronounced. Motivation Training a model on a single computer can take a long … Read more

MapReduce — A Helpful Illustrated Guide

MapReduce is the name of both (i) a distributed processing programming model provided by the Apache Foundation, and (ii) a functional processing technique. It consists of two steps: the map() function and the reduce() function. Map() converts each element in a data set into a modified element. Reduce() takes subsets of modified elements and aggregates … Read more

NumPy Average

NumPy is a popular Python library for data science focusing on arrays, vectors, and matrices. It’s at the core of data science and machine learning in Python. In today’s article, you’ll going to master NumPy’s impressive average() function that will be a loyal friend to you when fighting your upcoming data science battles. average(a, axis=None, … Read more