蠎加载 110

原文: Import Python Weekly Newsletter - Issue No 110 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Python 支撑每秒百万请求 + Japronto implements a pretty solid feature set:HTTP 1.x implementation with support for chunked uploadsFull support for HTTP pipelining, Keep-alive connections with configurable reaper, Support for synchronous and asynchronous views, Master-multiworker model based on forking, Support for code reloading on changes, Simple routing. (是也乎: Japronto 出来的… ) Reuven Lerner: 设置 Jupyter 服务器的五分钟指南 jupyter Nearly every day, I teach a course in Python. And nearly every day, I thus use the Jupyter notebook: I do my live-coding demos in it, answer students’ questions using it, and also send it to my students at the end of the day, so that they can review my code without having to type furiously or take pictures of my screen. (是也乎: Jupyter 内置了… ) 使用 Django,Celery 和 rabbitMQ 构建异步任务 celery, rabbitmq In this post, I’ll be talking about setting up a distributed task processing system for doing asynchronous processing. As your website grows and handles lot of traffic, there naturally comes a need to ensure best performance for your users. While there are multiple things which need to be done to achieve that, one of the most important things is processing things in background. (是也乎: 这个组合,有点儿… ) 使用 Arduino 和 Python 构建简单的摆锤来测量运动 arduino We’ll build a classic and important physical system, the simple pendulum. We’ll use an Arduino and a potentiometer to measure the amplitude of the pendulum’s motion and Python to read and visualize our data. 什么是Flake8和为什么我们应该使用它?? linting There are a couple good python code linter tools you can use. The one I’ve recently discovered is a Flake8. Which is “the wrapper which verifies pep8, pyflakes and circular complexity “. It has low rate of false positives. (是也乎: 徦阳性少的 linter.. ) 用 Python 运动跟踪 motion tracking My daughter, Alex, was in the 6th grade this year. For her science fair project, Alex wanted to do something involving animals. I had read about an experiment where lab rats were recorded on video, and their motion was analyzed by a computer (to determine the effects of a neurotoxin). We owned 2 gerbils, Havoc and Zoom, so I suggested to Alex we do a similar experiment with the gerbils. For some reason, she didn’t want to test a neurotoxin on her pets, so instead she decided to test the effects of full spectrum lighting on their movement. (是也乎: 儿童行为心理学方面的嗯哼 ) 用 Pytest 测试 Python 应用 testing Pytest stands out among Python testing tools due to its ease of use. This tutorial will get you started with using pytest to test your next Python project. (是也乎: Pytest 已经成为标准了… ) 为什么要学习Python?这里有8个数据驱动的原因 core-python Is Python worth learning? We’ve interviewed experts and surveyed the job market to identify the key reasons why you should learn Python today. Python Excel 教程: 初级导引 excel Python 的黑客指南 - 作者访谈 book review 机器学习与 Jupyter 使用 Scala,Spark 和 Python:安装 jupyter, spark Google Python Style Guide style guide This guide has been there for a while, sharing it again. (是也乎: 这份文档,值得一读再读 ) 绘制IMDb平均评分 matplotlib In the previous post (Playing with IMDB, Python and Pandas), I tried to obtain the average IMDb rating of an actress. This time I’ll play with matplotlib in order to plot the evolution of an actress over the years. 在 Python 中处理ssh ssh Working with the remote servers is a common scenario for most of us. Sometimes, we do our actual work over those remote computers, sometimes our code does something for us in the remote systems. Even Vagrant instances on your laptop are also remote systems, you still have to ssh into those systems to get things done. (是也乎: 早已可以了… ) 使用 Docker,Python,Amazon SNS 和 SQS 构建实时事件驱动的访问日志系统 docker, aws, sns, sqs 简易构造符号链接 code snippet I never could remember how to use it, mixing the order of the parameters, and the man page did not help. So I thought, why not write a small wrapper around it? 好物 ~ 包/模块/库/片段… ...

2017-02-10 · 3 min · 1265 words · ZoomQuiet

蠎加载 109

原文: Import Python Weekly Newsletter - Issue No 109 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Pycon 2017 议题选择 pycon The acceptance and rejection letters for pycon arrived this week and so did the final list of selected talks for Pycon US 2017. (是也乎: 相对国外的 PyCon 都是年头儿对上年回顾,中国的总是挤在年尾回顾当年… 因为春节哈… ) Python 异步 I/O 嗯哼 video, asyncio In this 90-minute video series, I walk through a book chapter about asynchronous I/O in Python called A Web Crawler With asyncio Coroutines, which was co-authored by the creator of Python. (是也乎: 直播读书? ) Instagram 关闭了 Python 的 GC memory management, garbage collection By dismissing the Python garbage collection (GC) mechanism, which reclaims memory by collecting and freeing unused data, Instagram can run 10% more efficiently. Yes, you heard it right! By disabling GC, we can reduce the memory footprint and improve the CPU LLC cache hit ratio. If you’re interested in knowing why, buckle up! (是也乎: 随着 Py 在生产线上越来越嗯哼, 对 GC 的怨念总是在积累,终于,这一天来了… ) Python 中重塑数据 I want to focus exclusively on the process of reshaping data, i.e. converting or transforming data from one format to another. data manipulation (是也乎: 不仅仅是格式转换, 更要有垃圾清理… ) Wolfram 的自动机, 用 Python 简单嗯哼出了一个 + Complexity science is one of my favourite topics, ever. Studying complexity is how I ended up in the computer science bandwagon in the first place, and I constantly find myself thinking about how individual agents’ decisions affect the overall state of systems. Self-organization and emergence are fundamental aspects of how the pieces of the complexity puzzle fit together, and Wolfram’s elementary cellular automata are a great way to understand them. (是也乎: Wolfram 安身立命的核心技术, 成熟运行20多年, 哪儿这么简单的可以嗯哼出来哪… ) 加速 Python performance, benchmarking This blog post gives an introduction to some techniques for benchmarking, profiling and optimising Python code. (是也乎: 又一个收集各种技巧的 blog ,不过, Python 的本意就不是为了运行时速度哪, 而是开发时效率… 所以… ) 在 Sublime Text 中对 Python 3.6 代码进行 lint subl Writing consistent, well-formed code is important. Of course the functionality of the code is paramount, yet in addition the styling and structure should follow a commonly accepted standards. Not only will it make the code more approachable to others, but also to yourself, when you return to an old piece of software, which you have not looked at for months or even years. You might even squash some bugs early on, by writing code in consistent manner. The process of styling and checking of these code qualities, is often referred as linting. (是也乎: 历史一再证明,一个稳定又开放的系统,总是能孕育出各种神奇的小品来 ) Assert Statements in Python core-python How to use assertions to help automatically detect errors in your Python programs in order to make them more reliable and easier to debug. (是也乎: 断言,断的好,测试跑的好. ) 黑客统计 Jupyter notebook I’ve chosen to start with Harvard’s Data Science course. I’m currently on week 3 and one of the suggested readings for this week is Jake VanderPlas’ talk from PyCon 2016 titled “Statistics for Hackers”. As I was watching the video and following along with the slides, I wanted to try out some of the examples and create a set of notes that I could refer to later, so I figured why not create a Jupyter notebook. (是也乎: 一份课堂作业,总是可以嗯哼到 ipynb 中来… ) 用 Python 来开始 Spark Streaming + Kafka kafka, spark In this article I am going to look at Spark Streaming. This is one of several libraries that the Spark platform provides (others include Spark SQL, Spark MLlib, and Spark GraphX). Spark Streaming provides a way of processing “unbounded” data - commonly referred to as “streaming” data. It does this by breaking it up into microbatches, and supporting windowing capabilities for processing across multiple batches. You can read more in the excellent Streaming Programming Guide. (是也乎: EK/LS 越来越有标准相了,当然的 Python 的各种绑定也快速跟上了, 幸福. ) Sheila Miguez 和 Will Kahn-Greene 以及他们对 Python 社区的爱: Community Service Award Quarter 3 2016 Winners pyvideos Sheila Miguez and William Kahn-Greene for their monumental work in creating and supporting PyVideo over the years. (是也乎: 静静等待华人获得.. ) 列表推导和生成器表达式 core-python Do you know the difference between the following syntax? [x for x in range(5)] , (x for x in range(5)), tuple(range(5)) Let’s check it. (是也乎: 细微处见真情 ) 用Django 和 ngrok 处理 webhooks In this article we’ll go over how to handle webhooks using Django, create a webhook in GitHub, and test the webhook on your local machine using ngrok. But first a brief primer on webhooks. Python 自测 quiz Comprehensive Python quiz and questions from basic to advanced level that help you to review your Python knowledge and become the master of Python. (是也乎: 又一个 Python 能力测试卷,,,在答案剧透前,可以嗯哼一下 ) 100 行以内的算法代码 algorithmic trading If you’re familiar with financial trading and know Python, you can get started with basic algorithmic trading in no time. (是也乎: 值得收藏, 但是,其实,最好是变成一个内建模块哪 ) Python 101 在 Leanpub Permanently 免费了 ebook (是也乎: 可是,为什么呢? 哈! 因为 201 要来了 ) 在 Django 表单中覆盖字段小部件属性或如何将占位符添加到属性? django Let’s say we have a contact form and we want to add placeholders to this form inputs so our rendered form has these cool input labels. How do we do that? 好物 ~ 包/模块/库/片段… ...

2017-02-05 · 4 min · 1653 words · ZoomQuiet

蠎加载 108

原文: Import Python Weekly Newsletter - Issue No 108 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 用 Apache Spark 对8千万 Amazon 产品进行嗯哼 apache spark I wrote a simple Python script to combine the per-category ratings-only data from the Amazon product reviews dataset curated by Julian McAuley, Rahul Pandey, and Jure Leskovec for their 2015 paper Inferring Networks of Substitutable and Complementary Products. The result is a 4.53 GB CSV that would definitely not open in Microsoft Excel. The truncated and combined dataset includes the user_id of the user leaving the review, the item_id indicating the Amazon product receiving the review, the rating the user gave the product from 1 to 5, and the timestamp indicating the time when the review was written (truncated to the Day). We can also infer the category of the reviewed product from the name of the data subset. (是也乎: 是的,现在公开的数据早已超过了 Excel 的能力! ) 语法~变量注释 variable annotation Python 3.6 added another interesting new feature that is known as Syntax for variable annotations. (是也乎: 为了性能, Py3 向 C++ 飞奔而去 ) 每个 Python 项目应该有什么? code quality Over the past few years, the Python programming language gained a huge popularity boost and its community grew faster than ever. With this growth, a lot of tools appeared that help the community keep things organized and accessible. In this article I am going to provide a short list of iteOver the past few years, the Python programming language gained a huge popularity boost and its community grew faster than ever. With this growth, a lot of tools appeared that help the community keep things organized and accessible. In this article I am going to provide a short list of items every Python project should have in order to be accessible and maintainable.ms every Python project should have in order to be accessible and maintainable. (是也乎: 这是又一份看起来简单,但是,坚持作到不容易的 check-list requirements.txt/setup.py/Tests/Documentation/Conclusion 以及一个不言则明的目录结构! ) 跟踪一个奇怪的Python内存泄漏 - 来自 Benoit Bernard debugging Benoit’s first article we shared couple of issues back talked about the memory leak in his crawler and how he found the culprit. In this second and final post of the series, you’ll find out how Benoit used a combination of techniques and tools to analyze and resolve memory leaks in his Python application. (是也乎: 这是个系列内存传说记述, ) 购物蓝分析 – 用 Python 分析可能组合 machine learning Have you ever asked yourself how the store managers decide on product shelf placement in retail stores? There must be some strategy behind it, right? It can’t be just a random choice. Almost on daily basis, you receive product purchase recommendations from variety of sources where you have left your “digital fingerprint”. In many cases these recommendations make sense, what leaves you puzzled, how did they figured it out? (是也乎: 揭示零售卖场货架布置的背后动机… ) 使用 Apache Spark 和 Catalyst 与 Kevin Beyer 构建现代数据发现和 BI 平台 spark Apache Spark Meetup talk on: Building a modern data discovery and BI platform using Apache Spark and Catalyst with Kevin Beyer 32x 倍提速: numpy, pandas, spark, tensorflow 以共同运行时(Weld) 在Python中应用高斯朴素贝叶斯分类器: 第一部分 machine learning, naive bayes Python requests 深挖 requests Lessons learned by replacing httplib in Apache Libcloud with requests. AWS Lambda 初学者指南 - 免费电子书 serverless, FAAS Author Michael Hausenblas explores several use cases where serverless is a great fit—primarily short-running, stateless jobs in event-driven architectures found in mobile or IoT applications. He also provides a guide for migrating from a monolithic application structure to serverless computing. The code snippet in the last chapter is in Python. Though it’s a toy application. 了解Python的下划线 core-python While the underscore is used for just snake-case variables and functions in most languages (Of course, not for all), but it has special meanings in Python. If you are python programmer, for in range(10) , init(self) like syntax may be familiar. 使用算法的文本分类 naive bayes Understanding how chatbots work is useful. A fundamental piece of machinery inside a chat-bot is the text classifier. Let’s look at the inner workings of an algorithm approach: Multinomial Naive Bayes. This is a classic algorithm for text classification and natural language processing (NLP). Fancy terms but how it works is relatively simple, common and surprisingly effective. (是也乎: 针对 chatbots 技术 ) Python代码库中最常用的单词 visualization (是也乎: 嗯哼… ) 对象内省的两个快速函数 - 作者 Vasudev Ram core-python As a curator I can state that Vasudev Ram is definitely one of the most consistent Python blogger in terms of no of articles / code snippets he writes. 好物 ~ 包/模块/库/片段… ...

2017-01-24 · 3 min · 1350 words · ZoomQuiet

蠎加载 107

原文: Import Python Weekly Newsletter - Issue No 107 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 将数据加载入 Pandas DataFrame: 硬的和爽的方法 pandas Data exploration, manipulation, and visualization start with loading data, be it from files or from a URL. Pandas has become the go-to library for all things data analysis in Python, but if your intention is to jump straight into data exploration and manipulation, the Canopy Data Import Tool can help, instead of having to learn the details of programming with the Pandas library. (是也乎: Canopy 有专用工具来加速,只是 Canopy 环境非常嗯哼… ) 推介 Python 类型注释 - By Guido Van Rossum, Greg Price, and David Fisher video, Guido Dropbox has several million lines of production code written in Python 2.7. As a first step towards migrating to Python 3, as well as to generally make our code more navigable, we are annotating our code with type annotations using the PEP 484 standard and type-checking the annotated code with mypy. In this talk we will discuss lessons learned and show how you too can start type-checking your legacy Python 2.7 code, one file at a time. We will also describe some of the many improvements we’ve made to mypy in the process, as well as some other tools that come in handy. (是也乎: 百万行代码级别的 py2->3 迁移经验分享… 有 Guido 座镇的项目都如此艰难,那么… py2 的确命不能绝也. ) 用 Python 处理 bug 并达到 186k requests/second sanic Sanic is a Python3 framework built using the somewhat newly introduced coroutines, harnessing uvloop and based on Flask. However, it had an issue preventing it from utilizing multiple processes correctly. (是也乎: 又一个 web 应用框架 Sanic, 当然主要面向 py3 ) 使用 AWS Lambda 中的 Python 来索引 Amazon Elasticsearch 服务中的 Metadata aws, elasticsearch, lambda, s3 Objects in S3 contain metadata that identifies those objects along with their properties. When the number of objects is large, this metadata can be the magnet that allows you to find what you’re looking for. Although you can’t search this metadata directly, you can employ Amazon Elasticsearch Service to store and search all of your S3 metadata. This blog post gives step-by-step instructions about how to store the metadata in Amazon Elasticsearch Service (Amazon ES) using Python and AWS Lambda. (是也乎: Lambda 哪, 神器,无主机微服务. ) 用 Pythonic 的姿态来搞 APIs tutorial Communication with external services is an integral part of any modern system. Whether it’s a payment service, authentication, analytics or an internal one?—?systems need to talk to each other. In this short article we are going to implement a module for communicating with a made-up payment gateway, step by step. (是也乎: 教程揭示了一个支付网关接口的形成过程 ) Python 工作环境配置终极指南 environment When you’re beginning, it’s pretty easy to setup your Python environment on Unix. But in time things can get messy due to multiple versions, interpreters, utilities and projects. (是也乎: 果断 pyenv+iPython ) “生成器: Python 中最嗯哼的迭代” Luciano Ramalho Iterables, iterators and generators are a key subject for effective Python usage, especially when processing large-scale data sets. Do you know why zip(*M) allows efficient traversal of a matrix M by columns? From the elegant for statement through list/set/dict comprehensions and generator functions, this talk shows how the Iterator pattern is so deeply embedded in the syntax of Python, and so widely supported by its libraries, that some of its most powerful applications can be overlooked by programmers coming from other languages. 在 Windows 机器中部署 Python 的三种方式 windows, installation One of the downsides is that despite the Python community’s attempts to make it an accessible tool for everyone, a lot of folks find the installation process daunting or confusing, including myself. Once I’d learned enough Python to tinker around, I didn’t know where to “go” on my computer to write it or what to do next. Today I’ll cover three ways to install Python on your Windows computer step by step. (是也乎: Rodeo->Anaconda->官方 图样图森破,俺推荐 Python(x,y) ) 从 PDF 输出表格到 Python DataFrame pandas, pdf, data frame It is simple wrapper of tabula-java and it enables you to extract table into DataFrame or JSON with Python. You also can extract tables from PDF into CSV, TSV or JSON file. (是也乎: 果断得通过中间纯数据文件转换. ) 半小时部署一个 Python 的 Telegram bot 到 Azure bot, telegram Almost two years ago Telegram let developers create bots quite painlessly. You can read an introduction about it on Telegram website. In this article we will create a simple bot in python, it’ll be hosted in Azure using Bottle framework. The bot will not do anything fancy, consider it as a template for your python based bots. (是也乎: 嗯哼?!是用 Bottle 开发的!? ) 用 Python 进行 Bayesian A/B 测试 statistics, Bayesian TensorBoard: 可视化学习 | TensorFlow tensorflow 介绍 TensorFlow: 解决一个简单的回归问题 Today I’ll try to explain how to hack TensorFlow to solve a simple regression problem. 属性访问是如何工作的? cpython Have you ever wondered how the CPython interpreter handles attribute access on a class or an instance of a class ? 好物 ~ 包/模块/库/片段… ...

2017-01-15 · 3 min · 1388 words · ZoomQuiet