Python Libraries

Python Libraries:

In this section we'll discuss various Python Libraries used for Python Programming are given below:
list of different Python Libraries are given below: Numpy, Matplotlib, Sympy, Scipy. The Python Libraries are that can help to use various Python programs and make it easy to write down code. 


What is a Python Numpy?

NumPy is a package in python that stands for ‘Numerical Python’. It is the core library used for scientific computing, which contains a powerful n-dimensional array object, provides tools for integrating C, C++, etc. It is useful in algebra, random number capability, and a lot of more. NumPy array uses a multi-dimensional container for generic data.

NumPy Array: Numpy array is an N-dimensional array object in the form of rows and columns. It can initialize NumPy arrays from nested Python lists then access its elements. 

The next thing which will come in your mind is:

How do I install NumPy?

To install Python NumPy, 

The first step is to go to your command prompt then type
 “pip install numpy”.

when the installation is completed, go to your IDE (For example PyCharm) and simply used it by typing:

 “import numpy as np”

Also, Read Introduction to Python 

2. Matplotlib

Matplotlib is a plotting library in Python for 2D plots of arrays. It is used alongside NumPy to provide an environment that is open source. It is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It was introduced in 2002 by John Hunter.

One of the benefits of visualization is that it allows visual access to huge amounts of data in easily digestible visuals. It consists of various plots like line, bar, Histograms, Error charts, Power spectra, Bar charts and Scatters Plots.

Installation :

In Windows, Linux and macOS distributions have matplotlib and most of its dependencies as wheel packages. Run the following command to install matplotlib package :

python - mpip install -U matplotlib

Importing matplotlib :

from matplotlib import pyplot as plt

import matplotlib.pyplot as plt

Basic plots in Matplotlib :

Matplotlib comes with various plots. Plots help to understand trends, patterns,  make correlations. They’re typically instruments for reasoning about quantitative information. Some of the examples of plots are: Line plot, bar plot, histogram, scatter plot, etc.

Also, Read Introduction to Python

3. SymPy

Sympy library in Python used for symbolic computation. It provides a standalone application as a library to other applications or to live on the web as SymPy Live in computer algebra capabilities. It is easy to install and to inspect because it is written entirely in Python with some dependencies. 

This is easy to access combined with a simple and extensible codebase during a common language to form SymPy a computer algebra system with a comparatively low barrier to entry.

It includes features from basic symbolic arithmetic to calculus, algebra, discrete mathematics, quantum physics. Sympy is capable of formatting the result of the computations as LaTeX code.

SymPy depends on mpmath, it is a pure Python library for arbitrary floating-point arithmetic and makes it easy to use.

Installing sympy module:

pip install sympy

SymPy as a calculator:

SymPy defines the given numerical types:

Rational and Integer. The Rational class represented by a rational number as a pair of two Integers, numerator and denominator, so Rational(1, 2) represents 1/2, Rational(5, 2) 5/2, and so on.
The Integer class represents the Integer number.

4. Scipy

Scipy is a free and open-source Python library used for scientific and technical computing. SciPy library is another addition to the simplest Python libraries list. It contains modules for optimization, linear algebra, integration, and statistics. 

However, the SciPy library and SciPy stack are different. Scipy library builds upon Python Numpy, providing modules for data mining based on concepts, for example, linear regression, model selection, dimensionality, optimization, integration, clustering, and other complex engineering and scientific procedures.

Installing the scipy module:

pip install scipy