Ext: 11 Useful Python libraries that you may not know about

Source: Internet
Author: User

Originally from: Http://www.techug.com/11-python-libraries-you-might-not-know

Currently, there are thousands of Python packages on the web, but few people can know them all. There are more than 47,000 package listings on PyPI alone.

Now, more and more data scientists are starting to use Python, and although they get a lot of benefit from pandas,scikit-learn,numpy, I still want to introduce them to some older and very useful Python libraries. In this article, I'll list some of the less well-known libraries, even if you're an experienced Python developer, and it's worth a look.

1) DeLorean

Dolorean is a very cool date/time library. JavaScript-like moment, with very well-developed technical documentation.

From DeLorean import deloreanest = "Us/eastern" D = DeLorean (Timezone=est)
2) prettytable

You may never have heard of the library because it is hosted in Googlecode. The prettytable is primarily used to build good output at the terminal or browser side.

From prettytable Import prettytabletable = prettytable (["Animal", "ferocity"]) Table.add_row (["Wolverine", 100]) Table.add_row (["Grizzly",] table.add_row (["Rabbit of Caerbannog", []) Table.add_row (["Cat",-1]) Table.add_row ([ "Platypus") Table.add_row (["Dolphin",]) Table.add_row (["Albatross",]) Table.sort_key ("ferocity") Table.reversesort = true+----------------------+----------+|        Animal        | ferocity |+----------------------+----------+| Rabbit of Caerbannog |    | |      Wolverine       |    | |       Grizzly        |    Online    | |       Dolphin        |    | |      Albatross       |    | |       Platypus       |    | |         Cat          |    -1    |+----------------------+----------+
3.snowballstemmer

Well, I'm also installing the library for the first time. This is a very skinny language conversion library, supported in 15 languages.

From Snowballstemmer import Englishstemmer, Spanishstemmerenglishstemmer (). Stemword ("Gregory") # Gregorispanishstemmer (). Stemword ("Amarillo") # Amarill
4.wget

Do you remember that every time you write a web crawler for a purpose, you don't have to do it again, because wget is enough for you to use. Wget is a python version of the web Crawler library, easy to use.

Import wgetwget.download ("http://www.cnn.com/") # 100% [ ............................................................................] 280385/280385

Note: Linux and OSX users use this: from
SH import wget. However, the Wget module also has a better argument handline.

5.PyMC

Scikit-learn seems to be the darling of all, but in my opinion, PYMC is more attractive. PYMC is mainly used for Bayesian analysis.

From pymc.examples import disaster_modelfrom pymc Import mcmcm = MCMC (Disaster_model) m.sample (iter=10000, burn=1000, thin=10) [-----------------100%-----------------] 10000 of 10000 complete in 1.4 sec
6.sh

The SH library is used to import shell commands into Python as functions. It is very useful to use in bash, but it is not easy to remember how to use it (i.e. recursively search for files) in Python.

From SH import findfind ("/tmp")/tmp/foo/tmp/foo/file1.json/tmp/foo/file2.json/tmp/foo/file3.json/tmp/foo/bar/ File3.json
7.fuzzywuzzy

Fuzzywuzzy is a string can be fuzzy matching of the library, we have time to see the source code.

From Fuzzywuzzy import fuzzfuzz.ratio ("Hits me with your best shot", "hits me with your pet shark") # 85
8.progressbar

ProgressBar is a progress bar library that provides a text-mode ProgressBar.

From ProgressBar import Progressbarimport Timepbar = ProgressBar (maxval=10) for I in range (1, one):    pbar.update (i)    time.sleep (1) pbar.finish () # 60% |########################################################                                      |
9.colorama

Colorama is mainly used to add a variety of colors to text and is very easy to use.

10.uuid

The UUID is a Python-based UUID library that implements the 1,3,4 and 5 versions of the UUID annotations, which is really handy to ensure uniqueness.

Import Uuidprint Uuid.uuid4 () # E7bafa3d-274e-4b0a-b9cc-d898957b4b61
11.bashplotlib

Bashplotlib is a drawing library that allows you to draw histograms and scatter plots using stdin.

$ pip Install bashplotlib$ scatter--file data/texas.txt--pch x

English Original: One Python Libraries might not Know

Ext: 11 Useful Python libraries that you may not know about

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.