I've seen both:
import scipy as sp
and:
import scipy as sc
Is there an official preference listed anywhere?
For example, in the Introduction of the Scipy documentation, it is recommended to
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt
but a similar abbreviation is not offered for the Scipy package.
In this question, sp
is recommended, but the link to the Scipy docs doesn't actually specify sp
over sc
.
SciPy stands for Scientific Python. It provides more utility functions for optimization, stats and signal processing. Like NumPy, SciPy is open source so we can use it freely.
Official abbreviation for: import scipy as sp/sc.
Install SciPy using the pip command Python consists of pip command which is an official package installer. It is a package manager, we can install, delete, or update any package. We need to install pip for using the pip command. Once the requirement is satisfied we can use the pip command in terminal.
SciPy is a collection of mathematical algorithms and convenience functions built on the NumPy extension of Python. It adds significant power to the interactive Python session by providing the user with high-level commands and classes for manipulating and visualizing data.
The "official" answer, according to the Scipy documentation, is that there is really no reason to ever
import scipy
since all of the interesting functions in Scipy are actually located in the submodules, which are not automatically imported. Therefore, the recommended method is to use
from scipy import fftpack from scipy import integrate
then, functions can be called with
fftpack.fft()
Personally, I always use
import scipy.fftpack
and live with the slightly longer function call
scipy.fftpack.fft(data)
This way I know where the functions are coming from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With