推薦11個(gè)實(shí)用Python庫(kù)
1) delorean
非常酷的日期/時(shí)間庫(kù)
from delorean import Delorean
EST = "US/Eastern"
d = Delorean(timezone=EST)
2) prettytable
可以在瀏覽器或終端構(gòu)建很不錯(cuò)的輸出
from prettytable import PrettyTable
table = PrettyTable(["animal", "ferocity"])
table.add_row(["wolverine", 100])
table.add_row(["grizzly", 87])
table.add_row(["Rabbit of Caerbannog", 110])
table.add_row(["cat", -1])
table.add_row(["platypus", 23])
table.add_row(["dolphin", 63])
table.add_row(["albatross", 44])
table.sort_key("ferocity")
table.reversesort = True
+----------------------+----------+
| animal | ferocity |
+----------------------+----------+
| Rabbit of Caerbannog | 110 |
| wolverine | 100 |
| grizzly | 87 |
| dolphin | 63 |
| albatross | 44 |
| platypus | 23 |
| cat | -1 |
+----------------------+----------+
3) snowballstemmer
非常瘦小的語(yǔ)言轉(zhuǎn)換庫(kù),支持15種語(yǔ)言
from snowballstemmer import EnglishStemmer, SpanishStemmer
EnglishStemmer().stemWord("Gregory")
# Gregori
SpanishStemmer().stemWord("amarillo")
# amarill
4) wget
Python的網(wǎng)絡(luò)爬蟲庫(kù)
import wget
wget.download("
# 100% [............................................................................] 280385 / 280385
5) PyMC
PyMC,一個(gè)用于貝葉斯分析的函數(shù)庫(kù)
from pymc.examples import disaster_model
from pymc import MCMC
M = MCMC(disaster_model)
M.sample(iter=10000, burn=1000, thin=10)
[-----------------100%-----------------] 10000 of 10000 complete in 1.4 sec
6) sh
將shell命令作為函數(shù)導(dǎo)入Python腳本
from sh import find
find("/tmp")
/tmp/foo
/tmp/foo/file1.json
/tmp/foo/file2.json
/tmp/foo/file3.json
/tmp/foo/bar/file3.json
7) fuzzywuzzy
用于字符串匹配率、令牌匹配等
from fuzzywuzzy import fuzz
fuzz.ratio("Hit me with your best shot", "Hit me with your pet shark")
# 85
8) progressbar
如其名,一個(gè)滾動(dòng)條函數(shù)庫(kù)
from progressbar import ProgressBar
import time
pbar = ProgressBar(maxval=10)
for i in range(1, 11):
pbar.update(i)
time.sleep(1)
pbar.finish()
# 60% |######################################################## |
9) colorama
一個(gè)色彩庫(kù),可以為文本添加豐富的色彩

10) uuid
一個(gè)可以產(chǎn)生唯一uuid的庫(kù)
import uuid
print uuid.uuid4()
# e7bafa3d-274e-4b0a-b9cc-d898957b4b61
11) bashplotlib
Python的繪圖控件,可以繪制直方圖、散點(diǎn)圖等
$ pip install bashplotlib
$ scatter --file data/texas.txt --pch x

以上就是本文推薦的11個(gè)使用的python庫(kù)了,也許有些你沒(méi)有見過(guò),但都是些非常棒的pyton庫(kù),希望大家能夠喜歡。
相關(guān)文章
python pandas loc 布爾索引示例說(shuō)明
loc跟iloc的區(qū)別,首先loc是location的意思,和iloc中i的意思是指integer,所以它只接受整數(shù)作為參數(shù),詳情見下面2022-03-03
python三種數(shù)據(jù)結(jié)構(gòu)及13種創(chuàng)建方法總結(jié)
拿Python來(lái)說(shuō),數(shù)據(jù)結(jié)構(gòu)的概念也是超級(jí)重要,不同的數(shù)據(jù)結(jié)構(gòu),有著不同的函數(shù),供我們調(diào)用,接下來(lái),我們分別來(lái)介紹字符串、列表、字典的創(chuàng)建方法2021-09-09
解決在keras中使用model.save()函數(shù)保存模型失敗的問(wèn)題
這篇文章主要介紹了解決在keras中使用model.save()函數(shù)保存模型失敗的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-05-05
Python一行代碼識(shí)別增值稅發(fā)票實(shí)現(xiàn)示例
這篇文章主要為大家介紹了Python一行代碼識(shí)別增值稅發(fā)票實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03
教你用python將數(shù)據(jù)寫入Excel文件中
Python作為一種腳本語(yǔ)言相較于shell具有更強(qiáng)大的文件處理能力,下面這篇文章主要給大家介紹了關(guān)于如何用python將數(shù)據(jù)寫入Excel文件中的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-02-02
Python logging管理不同級(jí)別log打印和存儲(chǔ)實(shí)例
這篇文章主要介紹了Python logging管理不同級(jí)別log打印和存儲(chǔ)實(shí)例,具有一定借鑒價(jià)值,需要的朋友可以參考下2018-01-01
windows python3安裝Jupyter Notebooks教程
這篇文章主要介紹了windows python3安裝Jupyter Notebooks教程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-04-04

