在pyspark中操作hdfs文件 [2016-08-02]
在pyspark中操作hdfs文件 背景 这段时间的工作主要是跟spark打交道,最近遇到类似这样的需求,统计一些数据(统计结果很小),然后直接把文本数据写入到hdfs文件中去。 之前一直使用的是scala语言,实现起来非常简单: import org.apache.spark.SparkContext import org.apache.hadoop.fs.{FileSystem, Path}...
View ArticleVideo: A Huge Debate: R vs. Python for Data Science
While the elections are over, some debates continue. R and python are both popular programming languages for data scientists. Each has its advantages for performing data science tasks. So, which one...
View Article数据分析师的福音――VS 2017带来一体化的数据分析开发环境
(此文章同时发表在本人微信公众号“dotNET开发经验谈”,欢迎右边二维码来关注。) 题记:在上个月的Connect() 2016大会上,微软宣布了VS 2017 RC的发布,其中为数据分析师带来了一体化的开发环境。 我们知道Visual Studio...
View ArticlePython2中的中文字符编解码浅析
自动化测试过程中,输入文本、读取文件、解析网络请求、字符串断言、正则匹配这些步骤都是必不可少的。而python是测试过程中最为常用的语言之一,很多测试团队的自动化代码和用例都是使用Python语言开发和维护的。...
View ArticleBrian Okken: 26: pyresttest Sam Van Oort
Interview with Sam Van Oort about pyresttest , “A REST testing and API microbenchmarking tool” pyresttest A question in the Test & Code Slack channel was raised about testing REST APIs. There were...
View Article关于 Python 生成器的那些事儿
写在前面的话 本来想这周继续写写 Flask 那点破事儿的,但是想了想决定换换口味,来聊聊很不容易理解但是很重要的 python中的生成器和协程。 Generators 科普 我猜大家对于生成器肯定并不陌生,但是为了能让我愉快的继续装逼,我们还是用点篇幅讲一下什么是生成器吧。比如在 Python 里,我们想生成一个范围 (1,100000) 的一个 list,于是我们无脑写了如下的代码出来...
View ArticleImport Python: Quiz Results
The Winners of the quiz are Nico Ekkart - @nicoekkart , Chad Heyne, Artem Bezukladichnii, Andrew Nester - andrewnester and Kyle Monson. Congrats. Your prize is on the way. The right answers to the...
View ArticleLet’s stop copyingC
Ah, C. The best lingua franca language we have… because we have no other lingua francalanguages. C is fairly old ― 44 years, now! ― and comes from a time when there were possibly more architectures...
View ArticleTaco Bell Parallel Programming
While working on migrating support.mozilla.org away from Kitsune (which is a great community support platform that needs love, remember that internet) I needed to convert about 4M database rows of a...
View ArticleDjango Weekly 15th Issue
Worthy Read The Changelog 229: python, Django, and Channels with Andrew Godwin - Podcast Django core contributor Andrew Godwin joins the show to tell us all about Python and Django. If you've ever...
View ArticleImport Python: ImportPython Issue 101 - Python Quiz Results, Deployment, Code...
Quiz Results Thanks everyone for participating in the quiz. Nico Ekkart, Chad Heyne, Artem Bezukladichnii, Andrew Nester and Kyle Monson Congrats. Your copies of Writing Idiomatic python is on its...
View ArticleIoT Sensor Nodes using Micro Python and the ESP8266
One challenge that is particularly interesting about the IoT is how to develop an Internet-connected sensor node. Sensor nodes must be able to interface to a wide range of industrial sensors and...
View ArticlePython内置函数(63)――super
英文文档: super ( [ type [, object-or-type ] ] ) Return a proxy object that delegates method calls to a parent or sibling class of type . This is useful for accessing inherited methods that have been...
View ArticleTen awesome, rigorous, and curated Python interview questions
The job market for python programmers has never been brighter. The US Bureau of Labour Statistics estimates that 100 new Python jobs are created each second and, by 2025, there will be more job...
View ArticleDjango 1.10.4 发布,Python Web 框架
Django 1.10.4 发布了,Django 是 python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 Web 应用程序框架。使用 Django,我们在几分钟之内就可以创建高品质、易维护、数据库驱动的应用程序。 更新内容如下: Bug修复 Quoted the Oracle test user’s password in queries to fix the...
View ArticlePyCharm创建virtualenv方法
python的版本众多,在加上适用不同版本的Python Package。这导致在同时进行几个项目时,对库的依赖存在很大的问题。这个时候就牵涉到对Python以及依赖库的版本管理,方便进行开发,virtualenv就是用来解决这个问题的。下面介绍使用PyCharm创建Virtual Environment的方法。 PyCharm可以使用 virtualenv...
View Articlepymysql 操作数据库
一.简介 pymsql是python中操作mysql的模块,其使用方法和MySQLdb几乎相同,但目前pymysql支持python3.x而后者不支持3.x版本 其执行语句与sql源码相似 二.使用 1.安装 pip install pymysql 2.使用操作 先来一例完整的连接加基本的操作 import pymysql# 创建连接conn =...
View ArticlePython检查xpath和csspath表达式是否合法
在做一个可视化配置爬虫项目时,需要配置爬虫的用户自己输入xpath和csspath路径以提取数据或做浏览器操作。考虑到用户的有时会输入错误的xpath或csspath路径,后台需要对其做合法性校验。 xpath有效性校验...
View Article盘点十大隐藏在Python中的彩蛋
1、使用re.DEBUG查看正则表达式的匹配过程 正则表达式是python的一大特色,但是调试起来会很痛苦,很容易得出一个bug。幸运的是,Python可以打印出正则表达式的解析树,通过re.debug来显示re.compile的完整过程。 一旦你理解了语法,你就可以发现你的错误。在这里我们可以看到[/font]忘了去除[] 2、enumerate函数用于遍历列表中的元素以及它们的下标...
View ArticlePython 描述器引导
1. python描述器引导(翻译) 作者: Raymond Hettinger 联系: <python at rcn dot com> 翻译: hit9, iceout 译者注: 原文链接- http://docs.python.org/2/howto/descriptor.html Contents Python描述器引导(翻译) 定义描述器,...
View Article