Summary of Contents

SciPy is the first library you should use when using Python to conduct scientific research. As you’ll see in this course, SciPy provides an ecosystem of libraries that work together to enable you to complete challenging scientific tasks with speed and accuracy.This guide will teach you how to:

**Find**information about all the things you can do with SciPy

**Install**SciPy on your computer

**Use**SciPy to cluster a dataset by several variables

**Use**SciPy to find the optimum of a function

Download the source code at the following URL to follow along with the examples in this tutorial:Differentiating between SciPy the Library and SciPy the EcosystemThere are a number of libraries that you’ll likely be advised to utilize while using Python for scientific computing activities, including:

These libraries were created to cooperate with one another to form the SciPy ecosystem. Many of them do computations directly using NumPy arrays. You should be familiar with constructing and using NumPy arrays before beginning this tutorial.Note: These tutorials are available if you need a fast introduction to or review of NumPy:

You will learn about the SciPy library, one of the essential elements of the SciPy ecosystem, in this course. The core Python library for scientific computing is called SciPy. For tasks such as numerical integration, optimization, signal processing, linear algebra, and more, it offers a variety of effective and user-friendly interfaces.Knowledge of SciPy ModulesThe SciPy library is made up of several modules that divide it into various functional sections. You can use help() on scipy to learn more about the many modules that SciPy includes. An example of this is provided below:

>>>

```
>>> import scipy
>>> help(scipy)
```

A sample of the help output generated by this for the full SciPy library is displayed below:

```
Subpackages
-----------
Using any of these subpackages requires an explicit import. For example,
``import scipy.cluster``.
::
cluster --- Vector Quantization / Kmeans
fft --- Discrete Fourier transforms
fftpack --- Legacy discrete Fourier transforms
integrate --- Integration routines
...
```

This code block displays the Subpackages section of the help output, which is a list of every calculation-capable module that is present in SciPy., like she did when she did, was to be, was to be, was to be, was to be, was to be, was to be, was to be, was to be, was to be, was to be SciPy requires that you specifically import the module you wish to use in order to use its features. A bit later in the lesson, you’ll see several instances of this, and the SciPy documentation contains instructions for importing libraries from SciPy.Once you’ve chosen which SciPy module to utilize, you can review the SciPy API reference for all the information on each module. The SciPy Lecture Notes are an excellent resource to go in-depth on several of the SciPy modules if you’re searching for something with a little more exposition.You’ll learn more about the SciPy library modules cluster and optimize later on in this lesson. You must first install SciPy on your machine, though.How to Install SciPy on a ComputerSciPy can be installed on your computer in two methods, as with most Python packages:

You may learn how to install the library using one of these methods right here. The NumPy package is the only direct dependency of SciPy. Regardless of the installation method chosen, NumPy and SciPy will both be set up automatically.AnacondaThe main reason Anaconda is a well-liked Python distribution is that it comes with pre-built editions of the most popular scientific Python programs for Windows, macOS, and Linux. Anaconda is a wonderful alternative to start with if Python isn’t yet installed at all on your machine. Once you’ve installed Anaconda, you’re doneāit already has SciPy and all of its necessary dependencies installed!From their downloads page, you can download and install Anaconda. Download the most recent version of Python 3. Depending on your platform, you can use the default setup process for a program once you have the installer on your computer.Note: Ensure that Anaconda is installed in a directory that you do not need administrator authority to change. This is the installer’s default setting.You can also install or update SciPy even if Anaconda is already set up on your computer. One of the following lines of code should be entered into the Anaconda Prompt on Windows, the terminal application on macOS, or Linux:

```
$ conda install scipy
$ conda update scipy
```

If SciPy needs to be installed, use the first line; if it only needs to be updated, use the second line. Start Python in your terminal and try to import SciPy to ensure that it is installed:

>>>

```
>>> import scipy
>>> print(scipy.__file__)
/.../lib/python3.7/site-packages/scipy/__init__.py
```

You imported SciPy into this code and printed the name of the file that SciPy is loaded from. This illustration uses macOS. Most likely, your computer will display a different location. SciPy is now installed and available for usage on your computer. To begin using SciPy, jump ahead to the following section.PipSciPy will be installed using pip if you already have a Python installation that isn’t Anaconda or if you don’t want to use Anaconda. Visit What Is Pip? to find out more about what pip is. A Beginner’s Guide to Pip and A Guide for New Pythonists.A format called wheels is used by pip to install packages. Code is compiled in the wheel format before being given to your computer. Although wheel format files differ differently from Anaconda format files and cannot be used interchangeably, Anaconda follows a strategy that is quite similar to this.