Skip to main content
Practice

What is SciPy and Why Use It?


SciPy (pronounced Sigh Pie) is an open-source Python library built on top of NumPy, designed for scientific and technical computing.
It provides a wide range of tools for mathematics, statistics, optimization, integration, signal processing, and more — all in one package.

If NumPy is your toolbox for arrays and numerical operations, SciPy is the workshop that adds advanced tools for real-world problem-solving.


Why Use SciPy?

Here are some key reasons SciPy is popular among scientists, engineers, and data analysts:

  • Comprehensive Functionality – Includes modules for optimization, statistics, linear algebra, and signal/image processing.
  • Built on NumPy – Fully compatible with NumPy arrays and functions.
  • Efficient and Reliable – Written in optimized C, C++, and Fortran under the hood for speed.
  • Extensive Documentation – Clear guides and examples for each function.

Example: Calculating a Statistical Measure

Example: Using SciPy to Calculate a Z-score
# Code to install SciPy in Jupyter Lite
import piplite
await piplite.install('scipy')

from scipy import stats
import numpy as np

# Example dataset
data = [10, 12, 9, 15, 14, 10, 13]

# Calculate z-scores
z_scores = stats.zscore(data)
print(z_scores)

This simple example uses scipy.stats.zscore() to compute how far each value is from the mean in standard deviations.


What’s Next?

In the next lesson, we’ll compare SciPy vs. NumPy to understand when to use each library.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.