The world’s leading publication for data science, AI, and ML professionals.

9 Unexplored Python Libraries that Will Amaze You

Python libraries to make your life much easier

Photo by Joshua Sortino on Unsplash
Photo by Joshua Sortino on Unsplash

Python programming is full of opportunities. It is straightforward and simple with lots of cool libraries and functions that can make tasks much easier. Every Python developer must work with popular libraries like NumPy, pandas, date time, matplotlib, Tkinter and many more. However, there are some lesser-known libraries that can make your life a lot easier as a developer and improve your coding experience.

In this article, I will discuss nine such Python libraries that you might be interested in. Some of these libraries can even be used as a replacement for some standard Python libraries. So they are definitely something to watch out for!


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.


Want to stay tuned with more similar exciting articles on Python & Data Science – do consider becoming a medium member using my referral link: https://pranjalai.medium.com/membership.


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.


If you are looking for more such cool capabilities of python then – Here is a book on Python programming that I would definitely recommend for all beginners.


Conclusion

These are some lesser-known libraries that can be used to improve your coding experience and replace the already existing standard Python libraries. You can get a detailed tutorial about the libraries in the documentation pages as most of them are open source.

These libraries can definitely make your life easier as a developer.

Note: This article contains an affiliate link. This means that if you click on it and choose to buy the resource I linked above, a small portion of your subscription fee will go to me.

However, the recommended resource is experienced by me and helped me in my data science career journey.


Before you go…

If you liked this article and want to stay tuned with more exciting articles on Python & Data Science – do consider becoming a medium member by clicking here https://pranjalai.medium.com/membership.

Please do consider signing up using my referral link. In this way, the portion of the membership fee goes to me, which motivates me to write more exciting stuff on Python and Data Science.

Also, feel free to subscribe to my free newsletter: Pranjal’s Newsletter.


Related Articles