9 Unexplored Python Libraries that Will Amaze You
By: Pranjal Saxena
Tags: Programming, Libraries, Python, Software Development, Data Science

1. Pendulum

Pendulum is an awesome Python library to work with dates and times. This library can be really useful in the cases where timezones are involved. The best part about the library is that it inherits from the Python DateTime library, so it can work with that library as well.

We can install the library using the following line of code.

pip install pendulum

Want to see some magic of the pendulum library? Check out the below line of code.

import pendulum past = pendulum.now().subtract(minutes=2)

past.diff_for_humans()

The good thing about using the pendulum module is user-friendliness. You can get exciting results.

2. Fabulous

Most of the Python applications that run on the command line look bland and boring. Fabulous can be used to give them a nice makeover by adding images, coloured text to the console.

To install fabulous we need to run the below python command.

pip install fabulous

To print a coloured text on the Terminal we can use

from fabulous.color import bold, magenta, highlight_red print(bold(magenta('''hello world this is some new line and here is the last line. :) ''')))

This library supports Python 2.6, 2.7, 3.3, 3.4, 3.5, and PyPy. You can also test it on Google Colab.

3. Pywebview

Pywebview is a python library for displaying HTML, CSS and JavaScript content in a GUI form. That means using this library you can display your website or webpage as a desktop application.

Install pywebview using the following command.

pip install pywebview

To launch a window that displays a given website we need to run

import webview webview.create_window(“Test window”, “target domain name”, width=400, height=200, fullscreen=False, resizable= true) webview.start()

A new window will launch for the webview.

4. Seaborn

Seaborn is a library used for data visualisation for data science projects. It is built on top of the standard visualisation library Matplotlib and can make the plots more colourful and attractive

To install it we can run the following command.

pip install seaborn

To make a line plot using a dataset we can use:

import seaborn as sns dataset=sns.load_dataset(“dataset name”) sns.lineplot(x=”x-axis name”, y=”y-axis name”, data = dataset)

5. Psutil

Psutil is a helpful cross-platform Python library phone getting information related to the system. One can gather information about the ongoing processes, CPU utilisation, RAM usage etc in a system.

Install psutil using the below command.

pip install psutil

To calculate the CPU utilisation by the system in an interval of 3 seconds we can run:

import psutil psutil.cpu_percent(interval=3)

6. PyGame

as the name suggests it is the Python library for making games. It contains many graphical and sound libraries that the developers can use for making games. Also, complex game logic and physics can also be implemented using the built-in modules of PyGame.

To install PyGame we need to use:

pip install pygame

7. Pyforest

when working on a data science project we need to import many libraries like NumPy, Pandas, Matplotlib, etc. The library Pyforest helps us to import all the important libraries together

We just have to run the following command.

pip install pyforest

And you can access all the libraries like NumPy, Pandas, Matplotlib, seaborn, etc. Pyforest also installs some other important libraries like os, tqdm, re etc.

8. Modin

Modin is a library that improves your Pandas workflow by utilising all the cores of a machine instead of a single core. This is especially helpful to improve the performance when working with large datasets.

You can install the library using the line of code.

pip install modin

Now, you can install it like this — so that you don’t need to make further changes to your code.

import modin.pandas as pd

That’s all you need to do. No further changes in the code are required.

9. Pandas_profiling

This is a Python library that can be used to get a general overview of a dataset, its attributes, and correlation among the attributes.

It can be installed using the command shown below.

pip install pandas-profiling

To get the analysis of a data frame and save the analysis in web format we can use

from pandas_profiling import ProfileReport report = ProfileReport(dataframe) report.to_file(output_file=’output.html’)

You can further save this report as HTML or pdf file for further analysis.