Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the less commonly used but useful Python libraries

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "uncommonly used but very useful Python library", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "what are the uncommonly used but useful Python libraries"?

Guide reading

When it comes to the python package of data science, you may think of numpy,pandas,scikit-learn and so on. Here we introduce some uncommonly used but very useful python packages, just like tickling. Although you can't use them most of the time, it's cool to use them. Python is a great language. In fact, it is one of the fastest growing languages in the world. In the field of data science and development, it provides convenience for us again and again. The entire ecology and library of Python makes it suitable for all users (beginners and advanced users). One of the reasons why Python is so successful is its library, which makes Python flexible and fast.

In this article, we will look at some less commonly used libraries of data science, except for pandas,scikit-learn,matplotlib and so on. Although when it comes to data science, we are thinking of pandas and scikit-learn, and there is no harm in learning about other python libraries. Here are some other Python libraries that might be used in data science.

Wget

It is a very important task for Python scientists to obtain data from the network. Wget is a free tool that allows non-interactive downloads of files from Web. It supports HTTP, HTTPS, and FTP protocols, as well as HTTP agents. Because it is non-interactive, it can be run in the background, even if the user is not logged in. So the next time you need to download pictures from the Internet, you can try wget.

Installation:

$pip install wget

Example:

Import wget url = 'http://www.futurecrew.com/skaven/song_files/mp3/razorback.mp3' filename = wget.download (url) 100% [...] 3841532 / 3841532 filename' razorback.mp3'Pendulum

What does this do? when you make a big deal with date and time, Pendulum is very suitable for you. This package is used to simplify the operation of date and time. For specific use, please see here.

Installation:

$pip install pendulum

Example:

Import pendulum dt_toronto = pendulum.datetime (2012, 1, 1, tz='America/Toronto') dt_vancouver = pendulum.datetime (2012, 1, 1, tz='America/Vancouver') print (dt_vancouver.diff (dt_toronto). In_hours () 3imbalanced-learn

In most classification problems, when the number of samples in all categories is roughly the same, the effect is the best, that is, sample equilibrium. However, in the actual situation, it is often unbalanced data, which will often affect the training process and the following prediction. Fortunately, this library can help us solve this problem. This is compatible with scikit-learn and is part of scikit-learn-contrib. You can try it next time.

Installation:

Pip install-U imbalanced-learn # or conda install-c conda-forge imbalanced-learn

Example:

Please refer to the documentation.

FlashText

When cleaning NLP-related data, it is often necessary to replace some keywords or extract some keywords. Usually, you can use regular expressions to do this job, but when the number of regular conditions is thousands, it will be very large. FlashText is a module based on the FlashText algorithm, which provides an alternative tool in this case. The best thing about FlashText is that the running time is independent of the number of search conditions. More information can be found here.

Installation:

$pip install flashtext

Example:

Extract keywords

From flashtext import KeywordProcessor keyword_processor = KeywordProcessor () # keyword_processor.add_keyword (,) keyword_processor.add_keyword ('Big Apple',' New York') keyword_processor.add_keyword ('Bay Area') keywords_found = keyword_processor.extract_keywords (' I love Big Apple and Bay Area.') Keywords_found ['New York',' Bay Area']

Replace keywords

Keyword_processor.add_keyword ('New Delhi',' NCR region') new_sentence = keyword_processor.replace_keywords ('I love Big Apple and new delhi.') New_sentence'I love New York and NCR region.'Fuzzywuzzy

The name sounds strange, but it's cool to use when the characters match. Can easily achieve character proportion, token ratio and so on. You can also match in different datasets.

Installation:

$pip install fuzzywuzzy

Example:

From fuzzywuzzy import fuzz from fuzzywuzzy import process # Simple Ratio fuzz.ratio ("this is a test", "this is a test!") 97 # Partial Ratio fuzz.partial_ratio ("this is a test", "this is a test!") 100PyFlux

Time series processing is a common problem in the field of machine learning. PyFlux is an open source Python library designed to deal with time series problems. This library contains a series of time series models such as ARIMA, GARCH and VAR. To put it simply, PyFlux provides time series to probability modeling, a trial of values.

Installation

Pip install pyflux

Examples

Refer to here.

Ipyvolume

Communicating results is a very important aspect of data science. Visualization of results is a very important advantage. IPyvolume is a 3D visualization library, but this is still in the stage of pre-1.0, so you can classify it this way: IPyvolume is the visualization of 3D data, and matplotlib is the visualization of 2D data. You can see here for details.

Installation

Using pip $pip install ipyvolume Conda/Anaconda $conda install-c conda-forge ipyvolume

Examples

Marking

Render

Dash

This is a Python framework produced by users who create web applications. Based on Flask, can be used to build data visualization app, these app can be rendered in a web browser. The user manual can be seen here.

Installation

Pip install dash==0.29.0 # The core dash backend pip install dash-html-components==0.13.2 # HTML components pip install dash-core-components==0.36.0 # Supercharged components pip install dash-table==3.1.3 # Interactive DataTable component (new!)

Examples

Gym

Gym comes from OpenAI and is used for reinforcement learning. Compatible with all numerical libraries, such as TensorFlow,Theano, etc. This library provides a problem testing environment that you can use to experiment with your reinforcement learning algorithms. These environments share interfaces that allow you to write general algorithms.

Installation

Pip install gym

Examples

Thank you for your reading, these are the contents of "what are the uncommonly used but useful Python libraries?" after the study of this article, I believe you have a deeper understanding of what the uncommonly used but useful Python libraries have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report