Python中import的机制与实现
转载 刘畅的博客 . 文章地址 .本文所涉及到的代码在 github 上 概述 python 是一门优美简单、功能强大的动态语言。在刚刚接触这门语言时,我们会被其优美的格式、简洁的语法和无穷无尽的类库所震撼。在真正的将python应用到实际的项目中,你会遇到一些无法避免的问题。最让人困惑不解的问题有二类,一个 编码问题,另一个则是引用问题。...
View Article在Python中用小波分析图像的哈希值
在python中用小波分析图像的哈希值 一点号数据玩家12小时前 限时干货下载: 回复【7】免费获取【完整数据分析资料!(包括SPSS、SAS、SQL、EXCEL、Project)!】 过去的几个周末,Kaggle的这个项目让我玩得乐此不疲Avito Duplicate Ads Detection...
View Article对Python的深度学习库Theano的介绍
对python的深度学习库Theano的介绍 1小时前来源:CSDN博客 本文为数盟原创译文,转载时请注明出处为“数盟社区”。 php?url=0Dm4uhBepK" alt="对Python的深度学习库Theano的介绍" /> Theano是一个Python库,可以在CPU或GPU上运行快速数值计算。...
View Articledjango-response对象
回顾 HTTP 协议的通信核心,无非就是请求报文和响应报文之间的交互。而请求报文由客户端生成,也就是用户的浏览器;响应报文则由服务器生成,作为web应用的开发者,大多数工作就是构造一个合适的响应报文。在 django 中,请求报文已经被封装成了 HttpRequest 对象,该对象的创建是自动的,且会传递给视图函数作为第一个参数。而 HttpResponse 对象则需要 web...
View Article使用 pyenv + virtualenv 打造多版本 Python 开发环境
本文最早发表于个人博客 Pylixm'wiki : http://pylixm.cc 配置环境: CentOS release 6.8 pyenv 20160509 在工作开发中,一直使用 virtualenv 来管理python的包环境。很好的解决了不同项目使用不同python包的需求。对于多python版本的问题如何解决一直无解,虽然可以安装多个...
View Articlepython -- 函数传参
一、参数传入规则 可变参数允许传入0个或任意个参数,在函数调用时自动组装成一个tuple; 关键字参数允许传入0个或任意个参数,在函数调用时自动组装成一个dict; 1. 传入可变参数: 1 def calc(*numbers):2 sum = 03 for n in numbers:4 sum = sum + n * n5 return sum以上定义函数,使用如下: 传入多个参数,...
View ArticleHacklet 114 Python Powered Projects
python is one of today’s most popular programming languages. It quite literally put the “Pi” in Raspberry Pi. Python’s history stretches back to the late 1980’s, when it was first written by Guido van...
View ArticleWavelet image hash in Python
For several weekends, I had fun playingKaggle: Avito Duplicate Ads Detection problem . This machine learningproblem includes more than 10 million images in addition to the structured data set. In this...
View ArticleDetermining Gender of a Name with 80% Accuracy Using Only Three Features
Introduction I thought an easy project to learn machine learning was to guess the gender of a name using characteristics of the name. After playing around with different features by encoding characters...
View ArticleTop pandas, numpy and scipy functions and modules used in github repos
Introduction Github recently introduced all files query-able on the Google BigQuery, SQL-like distributed query engine. See the announcement from github. You can execute the BigQuery queries at the...
View ArticlePython面向对象 杂篇(后记)
异常处理 什么是异常: 我们在调试程序时,常常会因为各种报错信息导致程序无法运行,异常也是一个对象,用来表示错误。我们可以捕捉异常,并做相应处理,从而增加代码的友好程度。 异常处理: 捕捉异常可以使用try/except语句。当代码运行过程中遇到try语句时,会先执行其中的代码,如果正常执行,则跳过except语句继续向下执行;如果触发异常,则执行except语句,由except语句进行异常处理。...
View ArticleWhy is Python slow
In case you missed it, Marius recently wrote a post on the Pyston blog about our baseline JIT tier. Our baseline JIT sits between our interpreter tier and our LLVM JIT tier, providing better speed...
View ArticleQuantLib Python Notebooks On Docker
Running QuantLib python notebooks on Docker The typical way to get QuantLib python running in your computer is by compiling QuantLib and the SWIG bindings in your computer. I have heard from some of my...
View Article使用 Python 编写一个 Memcached 的 CLI
原文地址: http://52sox.com/use-python-write-a-memcached-cli/ 近期在项目中使用到了Memcached,相比redis较为齐全的工具,这个非关系型数据库客户端只能通过 telnet 与服务器端进行交互,于是有了为这个数据编写1个简便的客户端工具的想法。 如果你使用过redis提供的 redis-cli...
View Article递归计算Ramanujan无穷根式
拉马努金无穷根式 是印度数学家拉马努金(Srinivasa Ramanujan)于20世纪初提出的。 f(x) = sqrt(1 + (x + 1) * f(x + 1)) 上面的函数是一个递归式,下面用python编程计算该函数的值。 Python代码: import mathclass Ramanujan(object): def sum(self, d, md): if d > md:...
View Articlescrapy1.1入门用例简介
今天将scrapy安装成功,测试了下,倒腾了好长时间,才倒腾成功,特此分享。 其实最好的老师就是scrapy的帮助文档,只要把文档看懂,照着做,也就啥都会儿了! 帮助文档下载见http://download.csdn.net/detail/flyinghorse_2012/9566467 0.新建立一个文件夹,用来存放相关文件,命名为test 1.构建scrapy project 运行命令:...
View ArticleApplied Deep Learning in Python Mini-Course
Deep learning is a fascinating field of study and the techniques are achieving world class results in a range of challenging machine learning problems. It can be hardto get started in deep learning....
View ArticleGalvanize: Introduction to Python for Data Science Seattle (7.11)
Data scientists need to know how to code, and python is the most useful and versatile programming language for doing data science. In this hands-on workshop, you’ll learn foundational skills for adding...
View ArticlePython面向对象之类的封装、继承与多态
python面向对象中类的三大特性,即封装、继承与多态,同时也是所有语言在面向对象编程中的重要特性,下面用实际的代码部分针对每一种特性做出说明。 一、封装 顾名思义,封装即把我们想要的内容封装到某个地方,因此在这里记录两个问题,一是如何封装、二是如何调用封装的内容。 1、封装数据 class Company: def __init__(self, dept, leader): self.dept =...
View Article