9 Hidden Gem Python Libraries You Should Know About!

explore nine lesser-known but powerful Python libraries that can enhance your coding efficiency and productivity.

9 Hidden Gem Python Libraries You Should Know About!
Photo by Road Trip with Raj on Unsplash

TIRED OF THE SAME OLD PYTHON LIBRARIES?

9 Hidden Gem Python Libraries You Should Know About!

While exploring Python libraries for my projects, I came across some hidden gems that don’t seem to get much attention. These libraries are incredibly useful, yet underrated.

In this guide, I’ll be revealing 9 underrated Python libraries that you should definitely know about!


1. Polars — The Fastest DataFrame Library

Tired of Pandas being slow for large datasets? Polars is a blazing-fast DataFrame library built on Rust, offering multi-threaded performance and outshining Pandas in speed.
https://pola.rs/

Installation:

pip install polars

Example:

import polars as pl 
 
df = pl.DataFrame({"name": ["Alice", "Bob"], "age": [25, 30]}) 
print(df.filter(pl.col("age") > 25))

It is 10–100x faster than Pandas for large datasets. It native support for lazy evaluation (efficient query execution).


2. Pydantic — Fast Data Validation & Parsing

If you’re dealing with API input validation or data parsing, Pydantic ensures type safety and validation with minimal effort.
https://docs.pydantic.dev/latest/

Installation:

pip install pydantic

Example:

from pydantic import BaseModel, ValidationError 
 
class User(BaseModel): 
    name: str 
    age: int 
try: 
    user = User(name="Alice", age="twenty-five") 
except ValidationError as e: 
    print(e)

It is used in FastAPI for lightning-fast request validation. Automatic type enforcement at runtime.


3. Ujson — Ultra-Fast JSON Parsing

Need faster JSON parsing than Python’s built-in json module? Ujson (UltraJSON) is up to 10x faster!
https://pypi.org/project/ujson/

Installation:

pip install ujson

Example:

import ujson 
 
data = {"name": "Alice", "age": 25} 
json_str = ujson.dumps(data) 
print(ujson.loads(json_str))

It handles large JSON files efficiently. It is Used in high-performance APIs and data pipelines.


4. Sh — Run Shell Commands Like Python Functions

Forget subprocess.run(). Sh lets you run shell commands with Python-like syntax!
https://sh.readthedocs.io/en/latest/

Installation:

pip install sh

Example:

import sh 
 
print(sh.ls("-l"))

It has cleaner syntax than subprocess. It is great for automating server tasks.


5. Arrow — The Best DateTime Library

Python’s datetime module is quite detailed and requires extensive syntax. On other hand Arrow makes date/time handling much easier!
https://pypi.org/project/arrow/

Installation:

pip install arrow

Example:

>>> import arrow 
>>> arrow.get('2013-05-11T21:23:58.970460+07:00') 
<Arrow [2013-05-11T21:23:58.970460+07:00]> 
>>> utc = arrow.utcnow() 
>>> utc 
<Arrow [2013-05-11T21:23:58.970460+00:00]> 
>>> utc = utc.shift(hours=-1) 
>>> utc 
<Arrow [2013-05-11T20:23:58.970460+00:00]> 
>>> local = utc.to('US/Pacific') 
>>> local 
<Arrow [2013-05-11T13:23:58.970460-07:00]> 
>>> local.timestamp() 
1368303838.970460 
>>> local.format() 
'2013-05-11 13:23:58 -07:00' 
>>> local.format('YYYY-MM-DD HH:mm:ss ZZ') 
'2013-05-11 13:23:58 -07:00' 
>>> local.humanize() 
'an hour ago' 
>>> local.humanize(locale='ko-kr') 
'한시간 전'

It simplifies date manipulation & formatting. It supports timezone conversion out-of-the-box.


6. Tenacity — The Best Retry Library

If you Want to auto-retry failing API requests? Tenacity makes it easy!
https://tenacity.readthedocs.io/en/latest/

Installation:

pip install tenacity

Example:

from tenacity import retry, stop_after_attempt 
 
@retry(stop=stop_after_attempt(3)) 
def never_gonna_give_you_up(): 
    print("Retry forever ignoring Exceptions, don't wait between retries") 
    raise Exception 
never_gonna_give_you_up()

It is perfect for unstable APIs and flaky connections. It Supports exponential backoff strategies.


7. IceCream — Debugging Made Fun

Please forget print(), IceCream (ic) makes debugging effortless!
https://github.com/gruns/icecream

Installation:

pip install icecream

Example:

from icecream import ic 
 
def foo(i): 
    return i + 333 
ic(foo(123)) 
 
# output 
>> ic| foo(123): 456

This library automatically adds variable names & locations in debug output.


8. PyWhatKit — Automate WhatsApp Messages & More!

If you Want to send WhatsApp messages, Google searches, or even draw ASCII art? PyWhatKit does it all!
https://pypi.org/project/pywhatkit/

Installation:

pip install pywhatkit

Example:

import pywhatkit 
 
# Send a WhatsApp Message to a Contact at 1:30 PM 
pywhatkit.sendwhatmsg("+910123456789", "Hi", 13, 30) 
# Same as above but Closes the Tab in 2 Seconds after Sending the Message 
pywhatkit.sendwhatmsg("+910123456789", "Hi", 13, 30, 15, True, 2) 
# Send an Image to a Group with the Caption as Hello 
pywhatkit.sendwhats_image("AB123CDEFGHijklmn", "Images/Hello.png", "Hello") 
# Send an Image to a Contact with the no Caption 
pywhatkit.sendwhats_image("+910123456789", "Images/Hello.png") 
# Send a WhatsApp Message to a Group at 12:00 AM 
pywhatkit.sendwhatmsg_to_group("AB123CDEFGHijklmn", "Hey All!", 0, 0) 
# Send a WhatsApp Message to a Group instantly 
pywhatkit.sendwhatmsg_to_group_instantly("AB123CDEFGHijklmn", "Hey All!") 
# Play a Video on YouTube 
pywhatkit.playonyt("PyWhatKit")

It Automates WhatsApp, YouTube searches, and image-to-text conversion. It is easy to use for small automation tasks.


9. Yake — Automatic Keyword Extraction from Text

Yake is an unsupervised keyword extractor — perfect for NLP applications!
https://github.com/LIAAD/yake

Installation:

pip install yake

Example:

import yake 
 
text = "Python is a powerful programming language used for web development, data science, and automation." 
kw_extractor = yake.KeywordExtractor() 
keywords = kw_extractor.extract_keywords(text) 
print(keywords)

It extracts important words from text without training data, great for SEO, NLP, and summarization.


Final Thoughts

These 9 Python libraries might be the underrated, but they can save you time, boost your productivity, and make development easier. Try them out and see how they can enhance your Python projects! 🚀

Which library are you excited to try? Let me know in the comments! 🚀