Department of Prepared By:
Computer Science Ms. Zainab Imtiaz
Python Library
A Python Library is essentially, in simple terms, is a collection of pre-combined codes that are used to
reduce the time taken to actually code. They are extremely useful to access pre-written, frequently used
codes — instead of writing them from scratch every single time.
Below are 21 Open Source Python Libraries that are commonly used.
• Scikit- learn • Keras
• NuPIC • Dash
• Ramp • Pandas
• NumPy • Scipy
• Pipenv • Matplotlib
• TensorFlow • Theano
• Bob • SymPy
• PyTorch • Caffe2
• PyBrain • Seaborn
• MILK • Hebel
• Chainer
NumPy
NumPy is a Python package which stands for ‘Numerical Python’. It is the core library for scientific
computing, which contains a powerful n-dimensional array object, provide tools for integrating C, C++
etc. It is also useful in linear algebra, random number capability etc. NumPy array can also be used as
an efficient multi-dimensional container for generic data.
NumPy Array
Numpy array is a powerful N-dimensional array object which is in the form of rows and columns. We
can initialize numpy arrays from nested Python lists and access it elements.
Install NumPy
To install Python NumPy, go to your command prompt and type “pip install numpy”. Once the
installation is completed, go to your IDE (For example: PyCharm) and simply import it by typing: “import
numpy as np”.
NumPy Array in Python
Python NumPy Array v/s List
We use python numpy array instead of a list because of the below three reasons:
1.Less Memory
2.Fast
3.Convenient
The very first reason to choose python numpy array is that it occupies less memory as compared to list.
Then, it is pretty fast in terms of execution and at the same time it is very convenient to work with
numpy. So these are the major advantages that python numpy array has over list.
Python NumPy Operations
Following are some common operations that can be performed on numpy array.
1. Ndim
2. Itemsize
3. Dtype
4. Reshape
5. Sort
6. max/ min
7. add
Pandas
Pandas is the most popular python library that is used for data analysis. It provides highly optimized
performance with back-end source code is purely written in C or Python.
We can analyze data in pandas with:
• Series
• DataFrames
Series is one dimensional(1-D) array defined in pandas that can be used to store any data type.
DataFrames is two-dimensional(2-D) data structure defined in pandas which consists of rows
and columns.
Scikit-learn
Scikit-learn is a free machine learning library for Python. It features various algorithms like support
vector machine, random forests, and k-neighbours,
from sklearn.naive_bayes import MultinomialNB
from sklearn.tree import DecisionTreeClassifier
Natural Language Toolkit (NLTK)
The Natural Language Toolkit (NLTK) is a platform used for building Python programs that work with human
language data for applying in statistical natural language processing (NLP).
It contains text processing libraries for tokenization, parsing, classification, stemming, tagging and semantic
reasoning.