The purpose of a library, a module and a function are the same. They are used for reusing the code. The concept of a function or a library is not new or specific to Python. It has been there for a long and is present in most the computer languages like C and C++.
A lot of Python expressions and statements form a function. A module is created by adding multiple functions and finally, numerous modules would make up a library.
This is the most important Python library for doing mathematical operations. It helps in performing algebraic calculations, solving statistical problems, and creating multi-dimensional arrays.
Some of the important NumPyfunctions:
NumPy.add(), NumPy.subtract(), NumPy.multiply(), NumPy.divide() , and NumPy.mod()
Some useful NumPy functions:
NumPy.nan(), NumPy.argmax(), NumPy.polyfit(), NumPy.random.choice(), NumPy.linspace()
It is the most common library used for data manipulation in python. This is built on NumPy. It is used for handling missing data, merging datasets, reshaping datasets, and doing the addition of columns in the data frame. This also has time series functionality used for forecasting.
Some of the important functions are:
pivot(), merge(), crosstab(), factorize(), isna(), andto_numeric() etc.
- Scikit learn
This is the most important library used for Machine Learning. This is built on top of NumPy, SciPy and Matplotlib. All the machine learning algorithms are part of this package.
Some of the modules it has are:
- a cluster contains the clustering algorithms. Some of the functions are Cluster. Kmeans(), Cluster. Affinity propagation()
- covariance used for estimating covariance.
- decomposition used for matrix decompostions and contains algorithms like Principal Component Analysis (PCA).
- ensemble containing ensemble methods.
- linear_model used for linear and logistic regression contains functions like sklearn.linear_model.LinearRegression(), sklearn.linear_model.SGDClassifier()
This is data visualization and analysis. Used to design bar charts, pie charts, scatter plots, histogram etc.
Some of the functions are
pyplot(), image(), contour(), axis(), colors(), lines(), and markers() etc.
Seaborn, which has advanced functions based on Matplotlib, NumPy, Pandas is used by data scientists to understand data distribution and relationships while building machine learning solutions.
This is most commonly used for web scraping to get data from HTML webpages.
Some of the functions are
get(), find(), get_text(), strip(), and split() etc.
This is built on top of tensorflow and used for Deep learning using neural networks. It is used for training models and testing models on large datasets. It also provides pre trained datasets like MNIST, ResNet etc.
Some of the important functions
Relu(), sigmoid(), softmax(), softplus(), and tanh() etc.
It is also a machine learning library built on Torch and competes with TensorFlow. It was introduced in 2017 and gaining popularity. It contains convolutional functions for neural networks like Conv1d(), conv3d(), pooling functions like avg_pool1d(), max_pool2d(), activation functions like relu_(), sigmoid(), softplus(), and tanh() etc.
- NLTK (Natural Language Toolkit)
This is the library used for Natural Language Processing. It is used for tokenization, Stemming, Lemmatization, Topic Modelling, Sentiment Analysis. Parts of Speech Tagging, Text classification etc.
It has various sub packages and sub modules
nltk.chat, nltk.classify, nltk.cluster, nltk.corpus, nltk.sentiment, nltk.tokenize,nltk.translate, and nltk.twitteretc
nltk.grammar, nltk.probability, nltk.tgrep, and nltk.utiletc.
Above list of Libraries are not exhaustive and there are multiple other libraries used as well.However, the ones mentioned above are the most widely used in industry for coding in Python.
Apart from the Libraries mentioned above, there are some important Python functions one should know about:
- Lambda: This is an anonymous function, which a user can define on their own and which can be used in a program. It is quite powerful and can be defined within another function.
- Reduce: This function is used for combining elements based on another function.
- Filter: This function is used to filter the collection of elements based on another function or expression.
~ Kapil Mahajan, Data Science Leader
Python is consistently ranked as the #1 programming language in the world. Being one of the most versatile languages, popular platforms such as YouTube, Google, and Facebook are built using Python. If you want to step into the world of this language, check out our data science courses that have modules teaching Python.