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

魔星 Magic star

魔星 Magic star Title: Magic star Date: 2017-01-23 20:42 Tags: DAMA,SiFi,write Slug: 170123-2002-magic-star Author: ZoomQuiet Status: published log.1 出发 """ …… 台湾海峡再次证明自己是名副其实的"亚细亚雷管"! 近日,台湾自治省首长 蒋孙介华,抓住本次人代会的一个有关税收法案的修定案大作文章,想取回号称台湾生命线的"泽华海底隧道"的控制权; 刚好时值亚太经济论坛进行间, 印度 作为台湾信息产业的合作伙伴照例全力声援; 奇怪的是, 刚刚因为大力协助外蒙古和平回归而成为中国最亲密盟友的苏盟,以及正值大选中的美国,都没有适时的表达看法,相反 OPEC 组织的所有成员国却分为两派激烈争论起来; 表面看来可能是台方预先承诺的海峡大陆架"能源农场"资本开放政策引起的连锁反应, 但是不排除这是续德国,大韩再次分裂后,台湾重新开始独立进程的前兆………… ...

2017-01-23 · 16 min · 7989 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