## Bollinger Bands Algorithm – Python Binance API for Crypto Trading

A Bollinger Band consists of three lines: a simple moving average, an upper band, and a lower band. The assumption is that if the real price crosses over one of the bands, this can be seen as a signal to trade in or our of a given asset. For cryptocurrencies, breakout trades are more frequently … Read more

## N-Grams in Python – How They Work

We hear more and more about natural language processing. In today’s world, the amount of text content produced is growing exponentially. In order to process a text with a machine learning model, it is important to find certain information and numerical features about the text. What Are N-Grams? N-Grams are one of the tools to … Read more

## NumPy all() – A Simple Guide with Video

Syntax numpy.all(a, axis=None, out=None, keepdims=<no value>, *, where=<no value>) Argument Type Description a array_like Input array axis None, int, or tuple of int Optional. One axis or multiple axes along which logical AND should be performed. Per default, it computes logical AND on the flat array. If this is a tuple of integers, calculates logical … Read more

## How to Find Outliers in NumPy Easily?

Can you spot the outliers in the following sequence: 000000001000000001? Detecting outliers fast can be mission critical for many applications in military, air transport, and energy production. This article shows you the most basic outlier detection algorithm: if an observed value deviates from the mean by more than the standard deviation, it is considered an … Read more

## How to Use Slice Assignment in NumPy?

NumPy slice assignment allows you to use slicing on the left-hand side of an assignment operation to overwrite a specific subsequence of a NumPy array at once. The right side of the slice assignment operation provides the exact number of elements to replace the selected slice. For example, a[::2] = […] would overwrite every other … Read more

## How to Rename Column Names in Pandas?

Problem Formulation Given a Pandas DataFrame with column labels, and a list of new column names as strings. How to change the column names to replace the original ones? Here’s an example using the following DataFrame: You want to rename the column names [‘Col_A’, ‘Col_B’, ‘Col_C’] to [‘a’, ‘b’, ‘c’] so that the resulting DataFrame … Read more

## NumPy Boolean Indexing

You can index specific values from a NumPy array using another NumPy array of Boolean values on one axis to specify the indices you want to access. For example, to access the second and third values of array a = np.array([4, 6, 8]), you can use the expression a[np.array([False, True, True])] using the Boolean array … Read more

## What’s the Best NumPy Book?

Fear of missing out in data science? Data science and machine learning are taking over. Data-driven decision making penetrates every single company nowadays. Data science is indeed the “sexiest job in the 21st century“! There is one Python library which is the basis of any data science related computation you can undertake as a Python … Read more

## np.nonzero() – A Simple Guide with Video

This article explains first how the NumPy nonzero() function works. It then goes on to apply it to a practical problem on how to find array elements using the nonzero() function in NumPy in a practical data science example. Syntax numpy.nonzero(a) The np.nonzero(arr) function returns the indices of the elements of an array or Python … Read more

## How to Change the Figure Size for a Seaborn Plot?

Seaborn is a comprehensive data visualization library used for the plotting of statistical graphs in Python. It provides fine-looking default styles and color schemes for making more attractive statistical plots. Seaborn is built on the top portion of the matplotlib library and is also integrated closely with data structures from pandas.                                                             How to change … Read more

## How to Select Multiple Columns in Pandas

The easiest way to select multiple columns in Pandas is to pass a list into the standard square-bracket indexing scheme. For example, the expression df[[‘Col_1’, ‘Col_4, ‘Col_7’]] would access columns ‘Col_1’, ‘Col_4’, and ‘Col_7’. This is the most flexible and concise way for only a couple of columns. To learn about the best 3 ways … Read more

## Python – Inverse of Normal Cumulative Distribution Function (CDF)

Problem Formulation How to calculate the inverse of the normal cumulative distribution function (CDF) in Python? Method 1: scipy.stats.norm.ppf() In Excel, NORMSINV is the inverse of the CDF of the standard normal distribution. In Python’s SciPy library, the ppf() method of the scipy.stats.norm object is the percent point function, which is another name for the … Read more