11个可能不知道的Python库
来源:互联网 发布:串口调试助手软件 编辑:程序博客网 时间:2024/05/21 13:21
目前,网上已有成千上万个Python包,但几乎没有人能够全部知道它们。单单PyPi上就有超过47000个包列表。
现在,越来越多的数据科学家开始使用Python,虽然他们从pandas,scikit-learn,numpy中获得了不少好处,但我仍想向他们介绍一些年长且非常实用的Python库。在本文中,我将列一些不太知名的库,即使你是经验丰富的Python的开发者,也值得过来一看。
1) delorean
非常酷的日期/时间库
from delorean import DeloreanEST = "US/Eastern"d = Delorean(timezone=EST)
2) prettytable
可以在浏览器或终端构建很不错的输出
from prettytable import PrettyTabletable = 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
非常瘦小的语言转换库,支持15种语言
from snowballstemmer import EnglishStemmer, SpanishStemmerEnglishStemmer().stemWord("Gregory")# GregoriSpanishStemmer().stemWord("amarillo")# amarill
4) wget
Python的网络爬虫库
import wgetwget.download("http://www.cnn.com/")# 100% [............................................................................] 280385 / 280385
5) PyMC
PyMC,一个用于贝叶斯分析的函数库
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
将shell命令作为函数导入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
用于字符串匹配率、令牌匹配等
from fuzzywuzzy import fuzzfuzz.ratio("Hit me with your best shot", "Hit me with your pet shark")# 85
8) progressbar
如其名,一个滚动条函数库
from progressbar import ProgressBarimport timepbar = ProgressBar(maxval=10)for i in range(1, 11):pbar.update(i)time.sleep(1)pbar.finish()# 60% |########################################################
9) colorama
一个色彩库,可以为文本添加丰富的色彩
10) uuid
一个可以产生唯一uuid的库
import uuidprint uuid.uuid4()# e7bafa3d-274e-4b0a-b9cc-d898957b4b61
11) bashplotlib
Python的绘图控件,可以绘制直方图、散点图等
$ pip install bashplotlib$ scatter --file data/texas.txt --pch x
【注】本文转自:http://blog.92fenxiang.com/articles/1421855937
0 0
- 你可能不知道的11个python库
- 11个可能不知道的Python库
- 11个实用但你可能不知道的Python程序库
- 11个实用但你可能不知道的Python程序库
- 11个实用但你可能不知道的Python程序库
- 你可能不知道的python
- 你可能不知道的30个Python语言的特点技巧
- 你可能不知道的30个Python语言的特点技巧
- 你可能不知道的30个Python语言的特点技巧(1)
- 你可能不知道的30个Python语言的特点技巧
- 你可能不知道的 30 个 Python 语言的特点技巧
- 30 个你可能不知道的 Python 语言特性和技巧
- 你可能不知道的 83 个 Photoshop 技巧
- 63个你可能不知道的生活小窍门
- 你可能不知道的10个JavaScript小技巧
- 你可能不知道的10个JavaScript小技巧
- 你可能不知道的10个JavaScript小技巧
- 你可能不知道的10个JavaScript小技巧
- POJ2524 - Ubiquitous Religions (并查集的基础应用)
- serialVersionUID作用
- UESTC 84 Binary Operations (dp+二进制枚举)
- 【线性代数公开课MIT Linear Algebra】 第六课 AX=b与列空间、零空间
- POJ1861 - Network (并查集,最小生成树)
- 11个可能不知道的Python库
- JavaWeb三层结构实例
- netty的对象的生命周期管理——引用计数
- HDU 4020 Ads Proposal
- C++细节问题
- Python中的对象的排序
- POJ1308 - Is It A Tree? (并查集)
- 15个易遗忘的Java问题
- Python中深拷贝与浅拷贝