Python 10 libraries that make work super efficient and interesting!

Hello everyone, today I will give you an inventory of 10 Python toolkits that make work more efficient and programming more interesting.

1 Pretty Errors

PrettyErrors is a powerful tool that can make exceptions thrown by Python easy to understand.

Example from the official website:

It can be seen that the wrong file, line, function or module is marked with different colors. Compared with the dense and dazzling error prompts on the left, the optimized prompts are obviously more humane!

There are two ways to install this tool:

# Global installation
python -m pip install pretty_errors

# local project use
import pretty_errors
pretty_errors.configure(
 separator_character = '*',
 filename_display = pretty_errors. FILENAME_EXTENDED,
 line_number_first = True,
 display_link = True,
 lines_before = 5,
 lines_after = 2,
 line_color = pretty_errors.RED + '> ' + pretty_errors.default_config.line_color,
 code_color = ' ' + pretty_errors.default_config.line_color,
 truncate_code = True,
 display_locals = True
 )
 pretty_errors. blacklist('c:/python')

2 Rich

Rich is a Python library that can provide rich text and beautiful formatting for the terminal. Using the Rich API, it is easy to add various colors and different styles to the terminal output. Rich can also draw beautiful tables, progress bars, markdown, source code and backtrace with syntax highlighting, etc.

Example from the official website:

Rich is a cross-platform library available for Linux, OSX and Windows. It is also very convenient to install.

python -m pip install rich

The blogger tried to use this library, the following is a test case, and the experience is full~.

from rich. console import Console
console = Console()

test_data = [
    {"Professional": "Pattern Recognition and Intelligent System", "Discipline": "Artificial Intelligence", "params": [None, 1, 2, 4, False, True], "id": "1",},
    {"Professional": "Pattern Recognition and Intelligent System", "Discipline": "Deep Learning", "params": [7]},
    {"Professional": "Pattern Recognition and Intelligent System", "Discipline": "Machine Vision", "params": [42, 23], "id": " 2"},
]

def test_log():
    enabled = False
    context = {
        "Weather": "Overcast",
    }
    movies = ["Manslaughter 2", "Jiangzhao Liming"]
    console.log("Hello from", console, "!")
    console.log(test_data, log_locals=True)

test_log()

3 Dear PyGui

Dear PyGui is an easy-to-use yet powerful non-terminal Python GUI framework.

Example from the official website:

Dear PyGui provides a highly dynamic user interface based on real-time rendering and GPU, and Dear PyGui is cross-platform, running on Windows
10. It can be used on macOS, Linux and even Raspberry Pi 4; the installation is also quite simple:

pip install dearpygui
or
pip3 install dearpygui

4 HummingBird

HummingBird is an artificial intelligence library launched by Microsoft, which can compile traditional artificial intelligence models into tensor calculations. Students who understand deep learning frameworks, such as Tensorflow and Pytorch, must know the importance of tensors.


HummingBird allows users to use various deep learning frameworks almost seamlessly to accelerate machine learning models. There are many benefits based on HummingBird:

  • All current or future optimizations in neural network frameworks will be introduced;
  • Hardware Acceleration;
  • Provides a unique unified platform to support all traditional machine learning models and deep learning;
  • No need to rebuild the model

In short, HummingBird has greatly lowered the entry threshold for deep learning.

The one-line installation code for the HummingBird library is as follows:

pip install hummingbird-ml

5 HiPlot

HiPlot is a library launched by Microsoft for analyzing high-dimensional data for artificial intelligence.

HiPlot is a lightweight interactive visualization tool to help AI researchers discover associations and inherent patterns in high-dimensional data, while using parallel rendering and other graphical methods to display information.

Example from the official website:

The one-line installation command for the HiPlot library is as follows:

pip install -U hiplot # Or for conda users: conda install -c conda-forge hiplot

6 Norfair

Norfair is a lightweight planar object tracking Python library.

With Norfair, you can give any detection algorithm the ability to track objects with just a few lines of code.

Example from the official website:

The one-line installation command for the Norfair library is as follows:

pip install norfair

7 GeoPandas

GeoPandas is a tool library for processing geospatial data. It not only perfectly integrates pandas data types, but also provides high-level interfaces for manipulating geospatial data.

Example from the official website:

The installation of this library is relatively complicated and requires the following dependencies:

  • numpy
  • pandas (version 1.0 or later)
  • shapely (interface to GEOS; version 1.7 or later)
  • fiona (interface to GDAL; version 1.8 or later)
  • pyproj (interface to PROJ; version 2.6.1 or later)
  • packaging

After installing the dependencies, you can run the installation command, as follows:

pip install pygeos

8 PyAutoGUI

PyAutoGUI is a cross-platform GUI automation Python module. Used to programmatically control the mouse and keyboard. Let the computer complete the automatic control tasks you design, freeing your hands

The modules that PyAutoGUI depends on will be automatically installed during installation, including PyTweening, PyScreeze, PyGetWindow, PymsgBox and MouseInfo, so it is very convenient to only need one line of command:

pip install pyautogui

There are also many encapsulated APIs for applications, such as:

# Move the mouse cursor to (200,300)
pyautogui. moveTo(200,300)
# Move the mouse cursor to (400,500)
pyautogui. moveTo(400,500)

I made a small example:

9 Plotly

Plotly is an interactive, open-source, browser-based graphing library for Python that provides more than 30 chart types, including

  • scientific chart
  • 3D chart
  • statistic chart
  • SVG map
  • financial chart

  • The one-line installation command for the Plotly library is as follows:
pip install plotly==5.6.0

It should be noted that plotly is built on jupyter notebook, so these two packages need to be imported in jupyter notebook instead of VSCode.

Official website example:

10 Emoji

Emoji is a very interesting Python library. In fact, the Unicode Alliance supports a complete set of emoji codes. The Emoji library provides a Python interface for printing emoji, making programming more interesting.

The one-line installation command for the Emoji library is as follows:

pip install emoji --upgrade

Take a look at the effect of the Emoji library printing emoticons:

>> import emoji
>> print(emoji.emojize('Python is :thumbs_up:'))
Python is
>> print(emoji.emojize('Python is :thumbsup:', language='alias'))
Python is
>> print(emoji. demojize('Python is '))
Python is :thumbs_up:
>>> print(emoji.emojize("Python is fun :red_heart:"))
Python is fun?

Message from blogger

Alright, let’s share here first. The benefits of Python are too great, and it can be used everywhere in life. How to learn Python is actually not difficult. That’s how I came here at the beginning. I learned first before I talked about it. It’s better to solve problems when I encounter problems than to imagine here. Step by step, move forward steadily. I don’t believe that I can’t learn. If you are ready to learn Python or are currently learning, the following should be useful to you:

How to learn Python?

To put it simply, learning Python is three steps, let’s take you to understand:

  • First, basic grammar learning
  • Second, formulate the development direction
  • Third, programming project practice

Python is easy to learn and easy to maintain, which makes many people start to learn, but many people also said that it is difficult to learn by themselves with zero foundation. The following will guide you to learn efficiently from the aspects of learning route, tutorials, development direction, and project practice! Learning Python well is good whether it is employment or sideline business to make money, but to learn Python, you still need to have a study plan. Finally, everyone will share a full set of Python learning materials to help those who want to learn Python!

1. Learning routes in all directions of Python

2. Python course video

When we watch videos and learn, we can’t just move our eyes and brain without using our hands. A more scientific learning method is to use them after understanding. At this time, the hands-on project is very suitable.

Three, Python actual combat case

Optical theory is useless, you have to learn to follow along, and you have to do it yourself, so that you can apply what you have learned to practice. At this time, you can learn from some actual combat cases.

Fourth, real interview questions for Internet companies

We must learn Python to find high-paying jobs. The following interview questions are the latest interview materials from first-line Internet companies such as Ali, Tencent, and Byte, and Ali bosses have given authoritative answers. After finishing this set The interview materials believe that everyone can find a satisfactory job.

This full version of the full set of Python learning materials has been uploaded to CSDN. If you need it, you can scan the QR code of CSDN official certification below on WeChat to get it for free [guaranteed 100% free]