Updated April 17, 2023
Introduction to Python libraries list
In Python, libraries are defined as a package or collection of various modules, which includes various functions or methods in modules that are imported into the program to perform some task without writing the large code snippets in the program. The program uses these libraries to make the codes smaller as these libraries are reusable pieces of code. In Python, there is very small little difference between package and library as a package contains a collection of modules that can be installed using the package manager in Python and libraries contains a set of Python functions. There are Python libraries list for various modern solutions.
Details of Python libraries
In Python, there are standard libraries that are very important in many different fields of technology. In Python, the library is a kind of file where it contains 1000’s of built-in modules or functions that provide various functionalities to the Python program, which will help to allow easy access to the system. When we are installing the Python software, we already have various libraries or a package that already comes with the software, and they are stored in a file named “lib”.
Let us see how to check about installed libraries in Python software on our PC:
Firstly we have to write the below statement in Python IDE
help ("modules")
Output:
In the above screenshot, we can see the list of Python modules or libraries that are already available, and these come along with Python software. If we need some other libraries, then we need to install the libraries using the pip command, or we can directly download the modules or packages and save them in the Python software folder to match the path when executing the results.
List of Python libraries
Now let us list a few important Python libraries:
There are many different libraries in Python which are very important and useful for the latest technologies like Data Science, machine learning, deep learning, etc. Let us see the list below:
1. Pandas
This is one of the open-source Python libraries which is mainly used in Data Science and machine learning subjects. This library mainly provides data manipulation and analysis tool, which are used for analyzing data using its powerful data structures for manipulating numerical tables and time series analysis.
To import this library to our Python program, we have to write the following code before starting with any program.
import pandas as pd
From the above statement, we import the pandas library into the program, and we can access this library by referring to “pd” as an alias to the pandas whenever a property or method of pandas needed to be called in the program.
Code:
import pandas as sn
x = sn.DataFrame()
print("The dataframe without passing any data is as follows:")
print(x)
print("\n")
l = ['Educba', 'Training', 'Institue']
print("The given list is ")
print(l)
print("\n")
x = sn.DataFrame(l)
print("The dataframe after passing the data is as follows:")
print(x)
Output:
2. Numpy
In Python, NumPy is another library that is used for mathematical functions. The NumPy library is popular for array and matrix processing using a set of mathematical functions. This library is mostly used in machine learning computations. We have to import NumPy as follows:
import NumPy as np
Let us see a simple example below
Code:
import numpy as yn
print("Python program for demonstrating NumPy for creating array:")
print("\n")
a = yn.array(['Educba', 'Training', 'Institute'])
print("The array created is as follows:")
print(a)
Output:
3. Requests
This is another different library module in Python used for sending HTTP requests and supports functionalities like adding headers, the formation of data, and accessing responsive data objects, which include content data, encoding data, status, etc. We first need to import this module as follows:
import requests
Let us see the below example;
Code:
import requests
print("Program to demonstrate requests library;")
print("\n")
x = requests.get('https://elearningindustry.com/directory/elearning-companies/educba')
print("The given http address is as follows:")
print(x)
print("\n")
print("The content of given http request is as follows:")
print(x.content)
Output:
4. Scipy
In Python, the scipy library is one of the open-source libraries mainly used in mathematical and scientific computations, technical and engineering computations. It is mainly built on NumPy. Let us a simple example below:
Code:
from scipy.special import comb, perm
print("Program to demonstrate scipy library")
print("\n")
print("To combination of 7 and 3 ")
c = comb(7, 3, exact = False, repetition=True)
print(c)
print("\n")
print("To find Permutation of 7 and 3")
p = perm(7, 3, exact = True)
print(p)
Output:
5. Sqllite3
Python programming language provides a library for database operations. This library is mainly used for database operations using sql queries. Let us see an example below:
Code:
import sqlite3
print("program to demonstrate sql library")
print("\n")
conn = sqlite3.connect('test.db')
print("Database has been opened successfully")
conn.execute('''CREATE TABLE school
(ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY REAL);''')
print("Database table has been created successfully")
conn.close()
Output:
In the above program, we can see that we are importing the sqllite3 library for performing database operations like database and table creation. We can see in the screenshot we have received the output saying both the database and table are created successfully.
Conclusion
In this article, we conclude that the Python programming language provides various libraries. In this article, we saw a few important and most popular libraries in Python that are used in the latest technologies like data science, machine learning, deep learning, data mining, etc. In Python, there are various libraries which are free and open-source libraries. We also saw how to check the installed libraries.
Recommended Articles
This is a guide to the Python libraries list. Here we discuss the important and most popular libraries in Python that are used in the latest technologies. You may also have a look at the following articles to learn more –