Summary
In Python, a library is a collection of modules that include pre-written code to assist with common tasks. Python has become one of the most popular programming languages in the world in recent years and one of the reasons why is thanks to its large collection of libraries that users can work with.
Python is an open-source programming language that is easy to learn, versatile and has a huge library of pre-built code and tools. Developers use Python in everything from machine learning, to web development and software development.
What is a Python library?
Before we look at the libraries, if you are a beginner or coming from another programming language, you might not be familiar with some of the words used in Python. Among these are scripts, modules, packages, and libraries.
- Scripts: A Python file that’s intended to be run directly. The purpose with the code in the script is to generate some sort of output, something that is suppose to happen in our program
- Modules: A Python file that’s planned to be imported into scripts or other modules. A module defines components like variables, functions, and classes planned to be used in other files that import it
- Package: A collection of related modules that work together to provide certain functionality. You can simply import them from the folder that they are stored in
- Libraries: Generally speaking it means “a bundle of code”. You could think of a library as a reusable piece of code that you may want to include in your programs/projects. In Python, a library is a collection of modules that include pre-written code to assist with common tasks.
The Python Standard Library contains hundreds of modules for performing common tasks, like sending emails or reading JSON data. The standard library is pre-installed when you install Python so you have all these modules ready to go when you start using Python, without having to download them separately.
Python Libraries have an essential role in machine learning, data science, visualisations, and so on, and are one of the reasons why Python is so popular
Top 10 Most Popular Python Libraries
In Python, a library is a collection of modules that include pre-written code to assist with common tasks. The most popular Python libraries include


Let’s have a closer look at them
Pandas
Pandas is used for
- Clean, Transform and Analyse data
- The backbone of most data projects
- Built on top of the NumPy package, so a lot of the structure of NumPy is used or replicated in Pandas
Features of Pandas in Python
- Fast and Powerful
- Flexible and Easy to use
- Open source
Useful Pandas resources
- Getting started and Tutorials for Pandas
- Cheat Sheet for Data Science with Pandas
- Cheat Sheet Data Wrangling with Pandas
NumPy
NumPy is used for
- Open-source library for working efficiently with arrays
- Makes complex mathematical implementations simpler
- Used together with other libraries like Matplotlib, NumPy can be viewed as an alternative to MATLAB’s core functions
Features of NumPy in Python
- Interactive and easy to use
- Speed for mathematical calculations
- Significantly improves the ease and performance of working with multidimensional arrays
Useful NumPy resources
Matplotlib
Matplotlib is used for
- Creating static, animated, and interactive visualisations in Python
- Produces publication-quality figures
- Has a wide variety of graphs and plots, such as histogram, bar charts, power spectra, error charts, and so on
Features of Matplotlib in Python
- Comprehensive library for visualisations in Python
- Open source and can be used freely
- Pyplot is a Matplotlib module which provides a MATLAB-like interface
Useful Matplotlib resources
- Matplotlib Tutorials and Users guide
- Cheat sheets and Handouts for Matplotlib
- Matplotlib Examples and Plot types
Seaborn
Seaborn is used for
- Creating visualisations
- High-level interface for drawing attractive and informative statistical graphics
- Considered as a upgrade of the Matplotlib library as it uses beautiful themes for plotting Matplotlib graphics
Features of Seaborn in Python
- Based on Matplotlib
- Integrates closely with Pandas data structures
- Helps you explore and understand your data with graphic representation of data
Useful Seaborn resources
- Seaborn User Guide and Tutorial
- Example and Inspiration Gallery for Seaborn Plots
- Cheat Sheet: Python Seaborn with code samples by Datacamp
TensorFlow
TensorFlow is used for
- Primarily for implementing machine learning and deep learning applications
- Beneficial when working with extensive datasets and object detection, and you require excellent functionality and high performance
- It combines computational algebra and optimisation techniques to allow for simpler calculation of a large number of mathematical equations
- Originally developed for large numerical computations
Features of TensorFlow in Python
- Open-source library developed by Google primarily for deep learning applications
- TensorFlow runs on Linux, MacOS, Windows, and Android
- Knowledge of artificial intelligence concepts might be beneficial
Useful TensorFlow resources


Keras
Keras is used for
- Deep learning and neural network modules
- Serve as an interface for the TensorFlow library
- Has a minimalistic and modular approach
Features of Keras in Python
- Easy to use and open source
- Organizations like Google, Netflix, Huawei and Uber are currently using Keras
- Built based on deep learning libraries like TensorFlow
- It runs on both the CPU and the GPU smoothly
Additional Keras resources
- Keras Learning Resources
- Code Examples for Keras in Python
- Keras Cheat Sheet: Neural Networks in Python by Datacamp
SciPy
SciPy is used for
- Provides functions for optimisation, stats and signal processing
- Extensively used for scientific and technical computations
- Built to work with NumPy arrays
Features of SciPy in Python
- Uses NumPy
- Open source and free to use
- Provides many user-friendly and efficient numerical routines
Useful SciPy resources
- Getting started and User guides for SciPy
- SciPy Lecture notes
- SciPy Cheat sheet: Linear Algebra in Python by Datacamp


PyTorch
PyTorch is used for
- One of the preferred platforms for deep learning research
- Used for computer vision and natural language processing applications
- Deep learning models for regression, classification, and predictive modelling tasks
Features of PyTorch in Python
- Open source machine learning framework
- Based on the Torch library
- Developed and maintained by Facebook (currently named Meta)
Additional PyTorch resources
- PyTorch Documentation and Tutorials
- PyTorch Examples on Github
- Dive into Deep Learning: Interactive E-book for Deep Learning with PyTorch
- PyTorch Cheat Sheet


Scrapy
Scrapy is used for
- Framework for large scale web scraping
- All the tools you need to efficiently extract data from websites
- Automatically search and find data on websites
Features of Scrapy in Python
- Open-source and collaborative framework
- Application framework for writing web spiders that crawl web sites and extract data from them
- Web scraping helps in converting unstructured data into a structured data
Additional Scrapy resources
SQLModel
SQLModel is used for
- Interacting with SQL databases with Python code
- Compatible with FastAPI, Pydantic, and SQLAlchemy
- Using standard Python classes and objects to, for example, query the database
Features of SQLModel in Python
- Based on Python type annotations
- Intuitive and Easy to use
- Great editor support
Additional SQLModel resources
Which Python library should I start with?
This is of course dependent on what you are going to do with your program. But generally speaking, Pandas should be first. Everything you do is data centric and Pandas contain a large number of functions for data import, export, indexing, and data manipulation. Next NumPy as it is an essential package for numerical computation in Python.
How to use a library in Python?
The Python Standard Library comes with the installation of Python. The Python standard library is very extensive and offers a wide range of uses with more than 200 core modules included.
If we want to use another library, for example one of the ones we have looked at in our top 10 list, we simply use the import statement. The import statement let’s us import the entire library or import specific items from a library.
How to download Python libraries?
You can use two ways to install Python libraries
- Python Package Index (PyPI): Pre-built packages can be downloaded from storages like the Python Package Index without you having to install them. The Python Package Index is a public repository of open source licensed packages made available for use by other Python users
- Hostings such as Github: Source code for packages can be downloaded or cloned from locations like Github, Gitlab, etc. After you have download the package, extract it into a local directory and follow any installation instructions
Where are the libraries stored in Python?
Python Modules are usually stored in /lib/site-packages in your Python folder. If you want to explore what directories Python looks in when importing modules, use the print statement with the name of the library with .path ending.
For example the command
- import sys
- print sys.path
Will display the current paths that Python are looking for modules
FAQ: Python programming
Why use Python libraries?
One of the reasons why Python is popular among developers is that it has a large collection of libraries that users can work with. Libraries are collections of pre-written code that anybody can access and use.
A Python programmer can use a lot of great code created by other developers. You don’t need to know how the library works, just how you can use it to solve your problem.
Which Python library should I learn first?
This is of course dependent on what you are going to do with your program. But generally speaking, Pandas should be first. Everything you do is data centric and Pandas contain a large number of functions for data import, export, indexing, and data manipulation. Next NumPy as it is an essential package for numerical computation in Python.
Which library is most used in Python?
Top 10 Python Libraries
• Pandas
• NumPy
• Matplotlib
• Seaborn
• TensorFlow
• Keras
• SciPy
• PyTorch
• Scrapy
• SQLModel
Where can I download Python libraries?
You can use two ways to install Python libraries
1. Python Package Index (PyPI): Pre-built packages can be downloaded from storages like the Python Package Index without you having to install them. The Python Package Index is a public repository of open source licensed packages made available for use by other Python users
2. Hostings such as Github: Source code for packages can be downloaded or cloned from locations like Github, Gitlab, etc. After you have download the package, extract it into a local directory and follow any installation instructions