scipy.stats.multivariate_normal: pdf, cdf, rvs and fit (With Examples)

scipy.stats.multivariate_normal tutorial: pdf, cdf, rvs, fit and marginal with tested examples

scipy.stats.multivariate_normal is SciPy’s multivariate normal (Gaussian) distribution. Give it a mean vector and a covariance matrix, then call pdf() for the density, cdf() for probabilities, rvs() for random samples and fit() to estimate the parameters from data. This guide explains each method with a complete, runnable example and checks the results against simulation. Every example … Read more >>

scipy.signal.freqz: Plot a Filter’s Frequency Response

Python SciPy freqz: the magnitude response of a Butterworth filter plotted in decibels

scipy.signal.freqz computes the frequency response of a digital filter from its coefficients. It returns two arrays: h is complex, which is the detail that trips most people up. You take abs(h) for magnitude and np.angle(h) for phase. Every number and plot below came from running the code on Python 3.12.5, SciPy 1.18.1, NumPy 2.5.3, Matplotlib … Read more >>

scipy.optimize.minimize: Methods, Bounds and Constraints

Python SciPy minimize: the Command Prompt comparing how many function evaluations each method needs

scipy.optimize.minimize finds the input that makes a function as small as possible: The starting guess matters, and so does result.success. A failed run still hands back an x, and it means nothing. All output below is from real runs on Python 3.12.5, SciPy 1.18.1, NumPy 2.5.3. Using scipy.optimize.minimize Pass a function and a starting point. … Read more >>

Python Scipy Confidence Interval [9 Methods]

python confidence interval

When I’m working with statistical analysis in Python, confidence intervals are one of the most powerful tools in my toolbox. They help me understand the reliability of my sample statistics and make informed decisions based on data. In this article, I’ll share 9 practical methods to calculate confidence intervals using SciPy, one of Python’s most … Read more >>

Python SciPy Exponential

exponential regression python

Recently, I was working on a data analysis project where I needed to model the time between customer arrivals at a store. The exponential distribution was perfect for this scenario, as it’s commonly used to model the time between independent events. SciPy, one of Python’s most powerful scientific libraries, offers excellent tools for working with … Read more >>

Python SciPy Chi-Square Test

chi square test python

Recently, I worked on a data analysis project where I needed to determine if there was a significant relationship between two categorical variables in my dataset. The chi-squared test was the ideal statistical method for this situation. Since Python’s SciPy library provides a straightforward implementation of this test, I decided to explore it in depth. … Read more >>

Scipy Find Peaks

find_peaks python

Recently, I was working on a signal processing project where I needed to identify peaks in time-series data from fitness trackers. The challenge was finding a reliable way to detect these peaks without manually parsing through thousands of data points. That’s when I turned to SciPy’s find_peaks function. It’s an incredibly powerful tool that makes … Read more >>

Scipy Stats Zscore: Calculate and Use Z-Score

python z.score

Recently, I was working on a data analysis project where I needed to identify outliers in a large dataset of customer transactions. The challenge was finding a standardized way to determine which values were significantly different from the rest. This is where the z-score calculation in SciPy came to my rescue. In this article, I’ll … Read more >>

Rotate Images with SciPy ndimage.rotate in Python

scipy rotate

Recently, I was working on an image processing project where I needed to rotate images at specific angles for data augmentation. The SciPy library offers a powerful function called ndimage.rotate that makes this task incredibly simple. In this article, I’ll cover multiple ways to rotate images using this function, including handling different interpolation modes and … Read more >>

Scipy’s Convolve Function

scipy convolve

Recently, I was working on a data analysis project where I needed to smooth out some noisy sensor readings. The solution? Convolution, an efficient mathematical operation that’s essential for signal processing, image filtering, and more. In Python, the scipy.signal.convolve function makes this complex operation surprisingly easy. In this article, I’ll share everything you need to … Read more >>