你可能没听过的11个Python库
目前,网上已有成千上万个Python包,但几乎没有人能够全部知道它们。单单 PyPi上就有超过47000个包列表。
现在,越来越多的数据科学家开始使用Python,虽然他们从 pandas, scikit-learn, numpy中获得了不少好处,但我仍想向他们介绍一些年长且非常实用的Python库。在本文中,我将列一些不太知名的库,即使你是经验丰富的Python的开发者,也值得过来一看。
1) delorean
Dolorean是一个非常酷的日期/时间库。类似JavaScript的moment,拥有非常完善的技术文档。
1 2 3 </td> | fromdeloreanimportDelorean EST="US/Eastern" d=Delorean(timezone=EST) | </tr> </tbody> </table> </div> </div>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 </td> | fromprettytableimportPrettyTable 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 | +----------------------+----------+ | </tr> </tbody> </table> </div> </div>
1 2 3 4 5 </td> | fromsnowballstemmerimportEnglishStemmer, SpanishStemmer EnglishStemmer().stemWord("Gregory") # Gregori SpanishStemmer().stemWord("amarillo") # amarill | </tr> </tbody> </table> </div> </div>
1 2 3 </td> | importwget wget.download(" http://www.cnn.com/") # 100% [............................................................................] 280385 / 280385 | </tr> </tbody> </table> </div> </div>
1 2 3 4 5 </td> | frompymc.examplesimportdisaster_model frompymcimportMCMC M=MCMC(disaster_model) M.sample(iter=10000, burn=1000, thin=10) [-----------------100%-----------------]10000of10000completein1.4sec | </tr> </tbody> </table> </div> </div>
1 2 3 4 5 6 7 </td> | fromshimportfind find("/tmp") /tmp/foo /tmp/foo/file1.json /tmp/foo/file2.json /tmp/foo/file3.json /tmp/foo/bar/file3.json | </tr> </tbody> </table> </div> </div>
1 2 3 </td> | fromfuzzywuzzyimportfuzz fuzz.ratio("Hit me with your best shot","Hit me with your pet shark") # 85 | </tr> </tbody> </table> </div> </div>
1 2 3 4 5 6 7 8 </td> | fromprogressbarimportProgressBar importtime pbar=ProgressBar(maxval=10) foriinrange(1,11): pbar.update(i) time.sleep(1) pbar.finish() # 60% |######################################################## | | </tr> </tbody> </table> </div> </div>
1 2 3 </td> | importuuid printuuid.uuid4() # e7bafa3d-274e-4b0a-b9cc-d898957b4b61 | </tr> </tbody> </table> </div> </div>
1 2 </td> | $ pip install bashplotlib $ scatter--file<spanid="0_nwp"style="width: auto; height: auto; float: none;"><aid="0_nwl"href=" http://cpro.baidu.com/cpro/ui/uijs.php?adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=18&is_app=0&jk=c83d3b1ac10215a4&k=data&k0=data&kdi0=0&luki=4&n=10&p=baidu&q=06011078_cpr&rb=0&rs=1&seller_id=1&sid=a41502c11a3b3dc8&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1922429&u=http%3A%2F%2Fwww%2Eadmin10000%2Ecom%2Fdocument%2F5893%2Ehtml&urlid=0"target="_blank"mpid="0"style="text-decoration: none;"><span style="color:#0000ff;font-size:14px;width:auto;height:auto;float:none;">data</span></a></span>/texas.txt--pch x | </tr> </tbody> </table> </div> </div>