Introduction to SciPy
tags: #python #python/statistic_modules
Getting started with scipy library
scipy is a library built on top of numpy to perform statistical computations (i.e., hypothesis testing, statistical significance, t-tests).
I. Installing scipy
pip install scipy
II. Importing scipy
Once SciPy is installed, import the SciPy module(s) you want to use in your applications by adding the from scipy import <module> statement:
from scipy import <module> # stats, constants
Scipy Modules
1. SciPy Statistical Significance Tests
SciPy provides us with a module called scipy.stats, which has functions for performing statistical significance tests.
This module also contains a large number of probability distributions, summary and frequency statistics, correlation functions
- Common library used for data science.
We can selectively import the stats module using the following command:
from scipy import stats
Alternatively, we can selectively import specific tests:
from scipy.stats import ttest_ind #two-sample t-test
2. SciPy Constants
SciPy also provides many built-in scientific constants.
These constants can be helpful when you are working with Data Science.
To import:
from scipy import constants
Example:
# importing pi
from scipy import constants
print(constants.pi)
3.141592653589793