蠎加载 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

蠎加载 106

原文: Import Python Weekly Newsletter - Issue No 106 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Go 跑 Python! golang, grumpy Grumpy is an experimental Python runtime for Go. It translates Python code into Go programs, and those transpiled programs run seamlessly within the Go runtime. We needed to support a large existing Python codebase, so it was important to have a high degree of compatibility with CPython (quirks and all). The goal is for Grumpy to be a drop-in replacement runtime for any pure-Python project. Curator’s note - If you are a Go Programming Language Developer do checkout http://importgolang.com/newsletter/ (是也乎: 玩具级,看爹了… ) 亲,2017 愿意升级到 Python 3.x 嘛? importpython Take the twitter poll, Do you see yourself using 3.x in 2017. (是也乎: 当前近6成的人原意升级,不过,真实来也得看项目是否允许了 ) Handling Unicode Strings in Python unicode I am a seasoned python developer, I have seen many UnicodeDecodeError myself, I have seen many new pythonista experience problems related to unicode strings. Actually understanding and handling text data in computer is never easy. Sometimes the programming language makes it even harder. In this post, I will try to explain everything about text and unicode handling in python. (是也乎: 简单的说用 Py3 …可是…唉;-( ) 5 things to watch in Python in 2017 An improved asyncio module, Pyjion for speed, and moving to Python 3 will make for a rich Python ecosystem. (是也乎: 又一个预言术…一切都在 py3 怎么赢得 google 的心了 ) 如何在 Linux 中安装 Scikit-Learn 来我开始机器学习的指南 machine learning In this Tutorial I will describe how you can get started with Machine Learning on Linux using Scikit-Learn and Python 3. 用 pbr 来作 Python 包管理 packaging A library for managing seatuptools packaging needs in a consistent manner. pbr reads and then filters the setup.cfg data through a setup hook to fill in default values and provide more sensible behaviors, and then feeds the results in as the arguments to a call to setup.py - so the heavy lifting of handling python packaging needs is still being done by setuptools. (是也乎: 什么年代了还是 ini 格式…也没有解决包的本地存储管理… ) BDFL 的启源 Guido This is an old article written by Guido van van Rossum himself. Occasionally people ask me about the origins of my nickname BDFL (Benevolent Dictator For Life). At some point, Wikipedia claimed it was from a Monty Python skit, which is patently false, although it has sometimes been called a Pythonesque title. I recently trawled through an old mailbox of mine, and found a message from 1995 that pinpoints the origin exactly. I’m including the entire message here, to end any doubts that the term originated in the Python community. (是也乎: 旧文有回甘… ) Armin 解说 Flask globals - Video flask, video This talk explores how you can build applications and APIs with Flask step by step by being easy to test and scale to larger and more complex scenarios. The talk will also go a bit into the history of some design decisions in Flask and what works well and in which areas you might want to mix it with other technologies for better results. 如何审查 Django ORM SQL 查询 ORM Copy-paste this into your Python 3 interpreter to see a human-readable version of the raw SQL queries that your Django code is running. DSF 宣布2016 Malcolm Tredinnick Memorial Prize 的获胜者 djangogirls Aisha (@AishaXBello) joined the Django community when she attended a Django Girls workshop during EuroPython in 2015. From that point on, Aisha’s trajectory in the Django world was unstoppable. She is not only a talented developer but her desire to keep learning and sharing her knowledge with others is simply inspiring. She organized or helped organize a huge number of Django Girls workshop in her home country of Nigeria. Thanks to her, Nigeria is on its way to be the world-record holder of most Django Girls events organized. (是也乎: 尼日利亚 的 ) Django 或 Flask - Reddit 讨论 flask (是也乎: 也属月经贴了…简单的说, 有銭就上 Django. ) 用NumPy进行通道检测 numpy, scipy Detect lanes on video frames, using NumPy and SciPy. My goal is not to achieve better performance or speed then with OpenCV. Rather, I’m going to implement some techniques learned at the Computer Vision course. (是也乎: OpenCV 也大量使用 Numpy ) Python 机器学习的副作用 machine learning 基于 IP 地址的天气预报 code snippet Jupyter + Pachyderm — 第1部分,探索和了解历史分析 jupyter 第 8 集: Armin Ronacher 谈 Flask,Python生态系统和Unicode podcast 用 Python 从头开始实现分类器令俺明白了什么? machine learning, classification Machine learning can be intimidating for a newcomer. The concept of a machine learning things alone is quite abstract. How does that work in practice ?. In order to demystify some of the magic behind machine learning algorithms, I decided to implement a simple machine learning algorithm from scratch. I will not be using a library such as scikit-learn which already has many algorithms implemented. Instead, I’ll be writing all of the code in order to have a working binary classifier algorithm. The goal of this exercise is to understand its inner workings. (是也乎: 这是理解目标对象的最精确学习方式, 再制丫的. ) 好物 ~ 包/模块/库/片段… ...

2017-01-05 · 3 min · 1351 words · ZoomQuiet