Exploring 15 Lesser-Known Python Packages to Enhance Your Skills
Written on
Python ranks among the most popular programming languages globally, favored by many beginners for its simplicity. While mastering Python is a journey, you can deepen your expertise by exploring its extensive array of packages. In a previous article, I highlighted 20 essential Python packages. Now, let's delve into 15 additional packages that you may not be aware of but can find incredibly beneficial. Let's dive in!
Algorithms
This package encompasses virtually every algorithm you might need.
Installation: pip install algorithms
Here’s a simple example demonstrating merge sort with this package.
This package extends beyond algorithms to include various matrix and graph operations. You can explore all the available algorithms in the official GitHub repository of Algorithms.
MoviePy
MoviePy is to video editing what Pillow is to image manipulation. This library allows you to perform a range of video editing tasks, including cutting, concatenation, and adding titles. It supports numerous audio and video formats, including GIFs, and works across various operating systems—Windows, Mac, and Linux—with support for Python 2.7+ and 3.
Installation: pip install moviepy
Let’s edit a video and insert a title using this library.
Check out this video tutorial on MoviePy by Coding Entrepreneurs on their YouTube channel.
Missingno
In data science, visualizing data is crucial for extracting meaningful insights. Missingno is a fantastic tool for data enthusiasts, as it allows you to identify and visualize missing values in datasets effortlessly with just one line of code. It supports various graphical representations such as bar plots, charts, and heatmaps.
Installation: pip install missingno
Let’s visualize the null values in the famous titanic dataset.
Faker
Sometimes, you need fictional data for testing purposes, particularly when a site requires personal information. Faker generates fake data and supports multiple languages, including English and Japanese.
Installation: pip install faker
Here’s how you can generate random data:
from faker import Faker
fake = Faker()
name = fake.name()
print(name)
address = fake.address()
print(address)
FlashText
Similar to regex, FlashText offers a faster alternative for searching and replacing text. It excels in speed and does not require case sensitivity.
Installation: pip install flashtext
Here’s an example of how to use it for text replacement:
from flashtext import KeywordProcessor
keyword_processor = KeywordProcessor()
keyword_processor.add_keyword('Mumbai', 'Mangos')
new_sentence = keyword_processor.replace_keywords('I love Big Apple and Mumbai.')
print(new_sentence)
Bashplotlib
Bashplotlib is a handy library for plotting simple graphs directly in your command line, especially useful without GUI support. It allows quick plotting with customization options for colors, size, titles, and shapes.
Installation: pip install bashplotlib
Here’s a full guide along with sample plots for you.
PrettyTable
Just as Bashplotlib helps with plotting, PrettyTable enhances the display of tables in the command line, providing numerous options for style refinement.
Installation: pip install prettytable
Let’s create and display a sample table in the command line.
VPython
VPython is an exciting package that enables 3D animation creation directly in the browser. It includes many predefined classes for building various 3D models.
Installation: pip install vpython
Let's create a classic rotating donut using this library.
FuzzyWuzzy
FuzzyWuzzy is a natural language processing library that compares two strings and returns their similarity percentage, utilizing Levenshtein Distance for accuracy.
Installation: pip install fuzzywuzzy
Here’s a simple usage example:
from fuzzywuzzy import fuzz
print(fuzz.ratio("This is an apple", "This one is an apple"))
Luminoth
If you're interested in deep learning, you may have heard of YoloV3. Luminoth is a TensorFlow-based computer vision library designed for object detection.
Installation: pip install luminoth
TextBlob
TextBlob leverages NLP techniques to classify text into various emotions and can perform tasks like part-of-speech tagging, sentiment analysis, and more.
Installation: pip install textblob
Here’s a simple example of classifying reviews with this library.
wget
The wget library simplifies web scraping tasks, whether you're after text, images, or even audio and video files.
Installation: pip install wget
Let’s download the entire source code of a Wikipedia page:
import wget
wget.download("https://en.wikipedia.org/wiki/Artificial_intelligence")
PrettyErrors
As the name suggests, PrettyErrors enhances the readability of error messages, making debugging much easier.
Installation: pip install prettyerrors
Let’s write some code with errors to see how this package improves error display.
Flowgiston
Flowgiston automates the creation of flowcharts for your programs, generating them upon execution.
Installation: pip install Flowgiston
UUID
This library generates a universally unique identifier (UUID) with minimal effort. UUIDs are often used for creating unique promo codes or identifiers.
Installation: pip install uuid
Here’s how to generate a random UUID:
import uuid
print(uuid.uuid4())
Recommended Reading
20 Python Packages That You Must Try
That Makes Your Life Easier
levelup.gitconnected.com
25 Useful Python One-Liners That You Should Know
That Makes Python Immortal
levelup.gitconnected.com
21 Python Mini Projects With Code
The Best Way to Learn a Programming Language is to Build Projects in It
levelup.gitconnected.com