## What is Data Science?

- We live in an information age, where the challenge is to extract meaningful information from large volumes of data.
- Data Science is the process of extracting knowledge and useful insights from data.
- Data Science uses scientific methods, algorithms, processes to extract this insight.
- Fields such as Analytics, Data Mining, and Data Science are devoted to the study of data.

In this article, we will understand the overview of Data Science. We will also go through the commonly used Python libraries that form an ideal part in a Data Scientist’s toolbox.

## Why Python for Data Science?

Python is undoubtedly a versatile and flexible language preferred by Data Scientists. The reasons are as follows:

- Python is simple, yet can handle complex mathematical processing and algorithms.
- Optimises development time due to its simple syntax.
- Has ready to use, in-built libraries that serve as Data Science tools.
- It is cross-platform and has huge community support
- Code written using other languages like C or Java can be directly used with the help of Python packages.
- Has excellent memory management capabilities. This makes code to execute faster when compared to other Data Science languages like MATLAB, R.

## Python Data Science Libraries

Python provides a huge number of libraries for scientific analysis, computing, and visualization. This is where the tremendous potential of Python is unleashed.

We will go through some of the popularly used Python libraries in the field of Data Science. The libraries are categorized according to their functionality.

## Core libraries

The core libraries can be imported by users to make use of its functionality. These are a part of the Python package.

### 1. Numpy

NumPy is a core Python package for performing mathematical and logical operations. It supports linear algebra operations and random number generation. NumPy stands for “Numerical Python”.

- NumPy has built-in functions to perform linear algebra operations.
- To perform logical and mathematical operations on arrays.
- NumPy supports multi-dimensional arrays to perform complex mathematical operations.
- Shape manipulatio using Fourier transforms.
- Inter-operability with programming languages like C, FORTRAN etc.

### 2. SciPy

SciPy is a Python library that is built upon NumPy. It makes use of NumPy arrays. SciPy is significantly used for performing advanced operations like regression, integration, and probability. It contains efficient modules for statistics, linear algebra, numerical routines, and optimization.

- Python SciPy library supports integration, gradient optimization, ordinary differential equation solvers, parallel programming tools and many more.
- An interactive session with SciPy is a data-processing and system-prototyping environment similar to MATLAB, Octave, Scilab or R-lab.
- SciPy provides high-level commands and classes for Data Science. This increases the power of an interactive Python session by significant order.
- Besides mathematical algorithms, SciPy includes everything from classes to parallel programming. This makes it easier for programmers to develop sophisticated and specialized applications.
- SciPy is an open source project. Hence, it has good community support.

### 3. Pandas

Pandas stands for Python Data Analysis Library. It is a Python library used for high-performance Data Science and analysis.

- Pandas provides a variety of built-in datatypes like Data Frame, Series, Panels. These Data Structures enables to accomplish the high-speed analysis of data.
- Provides tools to load data into in-memory data objects from various file formats.

provides integrated handling of missing data. - Reshaping large data sets due to label-based slicing and indexing.
- The tabular format of Data Frames allow database-like columns addition and deletion on the data.
- Group data based on aggregation.
- Functionalities for different data such as tabular, ordered and unordered time series
- Merging data to provide high performance.
- The panel data structure gives better visualisation of data due to it’s 3D data structure.

## Plotting Libraries

The key to Data Science is to present the outcome of complex operations on data in an understandable format.

Visualization plays an important role when we try to explore and understand data.

Python supports numerous libraries that can be used for data visualization and plotting. Let’s analyze some of the commonly used libraries in this field.

### 1. Matplotlib

- Matplotlib is a Python library for data visualisation.
- It creates 2D plots and graphs using Python scripts.
- Matplotlib has features to control line styles, axes, etc.
- It also supports a wide range of graphs and plots like histogram, bar charts, error charts, histograms, contour plots, etc.
- In addition, Matplotlib provides an effective environment alternative for MatLab, when used along with NumPy.

### 2. Seaborn

- Used along with Matplotlib, Seaborn is a statistical plotting library in Python.
- It provides a high-level interface to draw statistical graphics.
- The library is built on top of Matplotlib and it also supports Numpy and Pandas data structures. It supports statistical units from SciPy, too.
- As it is built on top of Matplotlib, we will often invoke matplotlib functions directly for simple plots.
- The high-level interface of seaborn and variety of back-ends for matplotlib combined together makes it easy to generate publication-quality figures.

### 3. Plotly

- Plotly is a Python library which is used for 3D plotting.
- It can be integrated with web applications.
- Its easy to use API can be imported and is compatible with other languages.
- Plotly can be used to represent real-time data. Users can configure the graphics of both clients, as well as server side and interchange data between them.
- Plotly inter-operates with Matplotlib data format.

#### Plotly Features

- Plotly is interactive by default.
- Charts are not saved as images. They are serialized as JSON. So it can be read easily with R, MATLAB, Julia, etc.
- Exports vector for print/publication.
- Easy to manipulate/embed on web.

## Natural Language Processing (NLP) Libraries

There is a huge boom in the field of speech recognition using Natural Language Processing. Python supports NLP through a huge number of packages. Some of the commonly used libraries are as follows:

### 1. NLTK

NLTK stands for Natural Language Toolkit. As the name implies, this python package is used for common tasks of Natural Language Processing(NLP).

#### Features of NLTK

- Text tagging, classification and tokenizing.
- Facilitate research of NLP and it’s related fields like Cognitive Science, Artificial Intelligence, semantic analysis, and Machine Learning.
- Semantic reasoning

### 2. SpaCy

- Spacy is an open-source library, focused on commercial use.
- SpaCy comprises neural network models for popular languages like English, German, Dutch, Sanskrit and many more.
- The popularity of SpaCy is due to its ability to process documents rather than data.
- SpaCy also provides useful APIs for machine learning and deep learning.
- Quora uses SpaCy as a part of its platform.

### 3. Gensim

- Gensim is a platform independent Python package that uses NumPy and SciPy packages.
- GenSim stands for GENerate SIMilar and can efficiently keep a huge amount of data in memory. Hence, it is widely used in healthcare and financial domains.
- Gensim features data streaming, handling large text collections and efficient incremental algorithms.
- Gensim is designed to extract semantic topics from documents. This extract is done automatically in an efficient and effortless manner.
- This actually differentiates it from other libraries, as most of them target only in-memory and batch processing.
- Gensim examines word statistical co-occurrence patterns within a corpus of training documents. This is done to discover the semantic structure of documents.

## Scraping Libraries

As the web is growing tremendously with each day, web scraping has gained popularity. Web scraping solves issues related to crawling and indexing of the data. Python supports many libraries for web scraping.

### 1. Scrapy

Scrapy is an open-source framework used to parse web pages and store data in an understandable format. Scrapy can process request asynchronously. This means it allows requests to be processed in parallel, without having to wait for a request to be finished.

It processes other requests, even though some requests fail or an error happens while processing it. Scrapy allows us to do very fast crawls.

### 2. Beautiful Soup 4

In short, called as BS4, Beautiful Soup is an easy to use Parser that is a part of Python’s standard library.

BS4 is a parsing library which can be used to extract data from HTML and XML documents.

BS4 builds a parse tree to help us navigate a parsed document and easily find what we need.

BS4 can automatically detect encoding and handle HTML docs with special characters.

### 3. Urllib

We can use Python urllib to get website content in a Python program.

We can also use this library to call the REST web services. We can make GET and POST http requests.

This module allows us to make HTTP as well as HTTPS requests. We can send request headers and also get information about response headers.

## Conclusion

In this article, we have categorized the commonly used Python libraries for Data Science. Hope this tutorial would help Data Scientists to deep dive into this vast field and make the most out of these Python libraries.