Assessment
Assessment
Level: VII
Reg_No: 21rp01138
Assessment
Python Libraries are a set of useful functions that eliminate the need for writing codes from scratch.
There are over 137,000 python libraries present today, and they play a vital role in developing machine
learning, data science, data visualization, image and data manipulation applications, and more. Let us
briefly introduce Python Programming Language and then directly dive into the most popular Python
libraries.
A library is a collection of pre-combined codes that can be used iteratively to reduce the time required
to code. They are particularly useful for accessing the pre-written frequently used codes instead of
writing them from scratch every single time. Similar to physical libraries, these are a collection of
reusable resources, which means every library has a root source. This is the foundation behind the
numerous open-source libraries available in Python.
Python library is a collection of modules that contain functions and classes that can be used by other
programs to perform various tasks.
Python libraries are a collection of related modules that contain bundles of codes that can be used in
different programs. Making use of Python libraries makes it convenient for the programmer as they
wouldn’t have to write the same code multiple times for different programs. Some common libraries are
OpenCV, Apache Spark, TensorFlow, NumPy, etc.
Top Python Libraries List:
1. NumPy:
2. Pandas:
Used for working with structured data, like tables or SQL tables.
3. Matplotlib:
4. Seaborn:
Built on top of Matplotlib, it provides a high-level interface for drawing attractive and informative
statistical graphics.
5. Scikit-learn:
Used for implementing various machine learning algorithms and tools for data mining and data analysis.
7. Requests:
Used for making HTTP requests, such as fetching data from a web API.
8. Beautiful Soup:
10. OpenCV:
MySQL is a powerful, open-source relational database management system. It is widely used in web
development and large-scale applications. To connect to a MySQL database using Python, you must
install the mysql-connector-python library.
Shell
import mysql.connector
Python
Create a connection to the MySQL database using the connect() method. Provide the necessary
credentials like hostname, username, password, and database name:
conn = mysql.connector.connect(
host="localhost",
user="your_username",
password="your_password",
database="your_database"
Python
cursor = conn.cursor()
Python
Step 5: Execute SQL Commands
Now you can execute SQL commands using the execute() method on the cursor object:
cursor.execute("CREATE TABLE IF NOT EXISTS users (id INT AUTO_INCREMENT PRIMARY KEY, name
VARCHAR(255), age INT)")
Python
After executing SQL commands, you need to commit changes to the database using the commit()
method. Finally, close the connection using the close() method:
conn.commit()
conn.close()
References
3. MyGreatLearning. (n.d.). Top 9 Open Source Python Libraries You Must Try in 2021.
MyGreatLearning. https://www.mygreatlearning.com/blog/open-source-python-libraries
4. Real Python. (n.d.). Python SQL Libraries: The Ultimate List. Real Python.
https://realpython.com/python-sql-libraries/