蠎加载 134

原文: Import Python Weekly Newsletter - Issue No 133 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 首则 Python Notebook - 学习 Pandas pandas A step-by-step guide to analyzing data with Python and the Jupyter Notebook. This textbook will guide you through an investigation of money in politics using data from the California Civic Data Coalition. The course will teach you how to use pandas to read, filter, join, group, aggregate and rank structured data. (是也乎: 值得体验, 一开始不是环境配置的都是骗纸… ) 在Python中重新进行单元测试和模拟 testing, mocking This post covers some higher-level software engineering principles demonstrated in my experience with Python testing over the past year and half. In particular, I want to revisit the idea of patching mock objects in unit tests. 数据科学: Python vs Pandas vs Numpy 的性能 - 机器学习实验 benchmark Speed and time is a key factor for any Data Scientist. In business, you do not usually work with toy datasets having thousands of samples. It is more likely that your datasets will contain millions or hundreds of millions samples. Customer orders, web logs, billing events, stock prices – datasets now are huge. (是也乎: 虽然 Numpy 以及 Pandas 都是 python 写的, 但是,作两样的事儿, 效率就是不同的哪… ) 通用 Jinja: 疯狂的想法 Python-ready 前端 jinja, frontend development Python 3 vs Python 2: 这次真咯不一样了 Python 3 A difficult decision for any Python team is whether to move from Python 2 and into Python 3. Although this is not a new decision for Python development teams, 2017 brings with it several important differences that make this decision crucial for proper forward planning. It feels like this is the year that we’re really seeing the move to Python 3. It has been a long road, but Python 3 may finally have the upper hand. Python 中的解析: 可用的所有工具和库 parsing conda-merge project, reader submission Tool for merging Conda (Anaconda) environment files into one file. This is used to merge your application environment file with any other environment file you might need (e.g. unit-tests, debugging, jupyter notebooks) and create a consistent environment without breaking dependencies from the previous environment files. (是也乎: 刚需哪! ) faker-schema project, reader submission Generate fake data using joke2k’s faker and your own schema. (是也乎: 虚拟数据的模式化生成 ) Dockerizing Django, uWSGI 以及 Postgres 的生产路径 django, docker Let’s dockerize a serious Django application. Curator’s note - Love the humour in the article. 创建自己的 Cryptocurrency - 用 Python cryptocurrency I’ve been itching to build my own cryptocurrency… and I shall give it an unoriginal name - Cranky Coin. After giving it a lot of thought, I decided to use Python. GIL thread concurrency is sufficient. Mining might suffer, but can be replaced with a C mining module. Most importantly, code will be easier to read for open source contributors and will be heavily unit tested. Using frozen pip dependencies, virtualenv, and vagrant or docker, we can fire this up fairly easily under any operating system. (是也乎: 又一种 Coin 的加密算法 ) 创建 Jupyter 笔记本小部件 jupyter This post will provide a step-by-step tutorial for creating and running a Jupyter widget. 让我们建立最小的块链 blockchain In Less Than 50 Lines of Python. Python3 asyncio - 从同步代码调用异步代码 asyncio (是也乎: golang 的最大思想贡献: 用同步代码形式,运行异步效果 ) 好物 ~ 包/模块/库/片段… ...

2017-07-21 · 3 min · 1060 words · ZoomQuiet

蠎加载 133

原文: Import Python Weekly Newsletter - Issue No 133 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 与 Python 中长时间运行的子进程交互 debugging The Python subprocess module is a powerful swiss-army knife for launching and interacting with child processes. It comes with several high-level APIs like call, check_output and (starting with Python 3.5) run that are focused at child processes our program runs and waits to complete. In this post I want to discuss a variation of this task that is less directly addressed - long-running child processes. (是也乎: 作者脑补出了几种方案, 但是,都不嗯哼… 其实吧长时间运行, 要不服务化, 要不事务化, 就别想着中间还能嗯哼什么, 毕竟这是冯机体系不是代码和运行时一致的 LISP 世界. ) 传说: 一个深度学习分类器,可以压缩 Unicode 和奇怪的 Youtube 评论 machine learning One of the things I’ve been thinking about recently is how to do natural language processing (NLP) effectively with deep neural networks using real world language examples. An example would be to classify the youtube comment 探索并清洗科学家联盟的卫星数据库 data science The Union of Concerned Scientists maintains a database of ~1000 Earth satellites. For the majority of satellites, it includes kinematic, material, electrical, political, functional, and economic characteristics, such as dry mass, launch date, orbit type, country of operator, and purpose. The data appears to have been mirrored on other satellite search websites, e.g. http://satellites.findthedata.com/ . This iPython notebook describes a sequence of interactions with a snapshot of this database using the bayeslite implementation of BayesDB, using the Python bayeslite client library. The snapshot includes a population of satellites defined using the UCS data as well as a constellation of generative probabilistic models for this population. 实体提取和网络分析 machine learning How you can extract meaningful information from raw text and use it to analyze the networks of individuals hidden within your data set. 使用 scikit-learn 制作电子商务业务决策 machine learning, scikit-learn Today, let’s learn how to build a simple linear regression model using Python’s Pandas and Scikit-learn libraries. Our goal is to build a model that analyses customer data and solves a problem for a (simulated) e-commerce business. (是也乎: 反复强调了简单的, 即无实用价值的… ) Python 怪癖: 注释 core-python 使用 Locust.io 和 Docker Swarm 进行负载测试 testing, docker, locust FAT Python : Python优化的下一章 optimization The FAT Python project was started by Victor Stinner in October 2015 to try to solve issues of previous attempts of “static optimizers” for Python. Victor has created a set of changes to CPython (Python Enhancement Proposals or “PEPs”), some example optimizations and benchmarks. We’ll explore those 3 levels in this article. K 平均聚类在 Python 中 machine learning f-strings For the Win f-strings It has been a long time coming, but I am now actively migrating existing projects to Python 3. Python 3.6 specifically, because when I am done I will be able to take advantage of my new favourite feature everywhere! That feature is f-strings. (是也乎: PEP-0498 的心声 Python 3.6.1 (…) Type “help”, “copyright”, “credits” or “license” for more… name = ‘Albert’ f’Hello, {name}!' ‘Hello, Albert!’ 嚓, f 算子… ) ...

2017-07-14 · 3 min · 1258 words · ZoomQuiet

蠎加载 132

原文: Import Python Weekly Newsletter - Issue No 132 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 将 Python 和 Assembly 的力量联合起来 asm We can’t just copy/paste ASM directly into a Python script. Instead, python reads the machine code in as a bytearray of shellcode where the binary data is represented by a hex value where the \x represents the offset. (是也乎: ASM … ) pythonbooks.org books Discover the best books in every Python book category. (是也乎: 太实用了…当然的, 没有一本中国原创的. ) 用 Hydrogen 进行交互 IDE Hydrogen is a package for Atom editor that allows interactive programming in different languages. I would call it a bridge, or even a sweet spot, between Jupyter Notebooks and a full blown IDE (like IntelliJ IDEA). (是也乎: 桥件,能将 Jupyter 和 IDE 粘合起来 ) 深入 Closures 和 Decorators - 第一部分 closures 使用进程池加速您的Python数据处理脚本 futures With the concurrent.futures library, Python gives you a simple way to tweak your scripts to use all the CPU cores in your computer at once. Don’t be afraid to try it out. Once you get the hang of it, it’s as simple as using a for loop, but often a whole lot faster. (是也乎: 问题是前提,你的数据是可原子切分处理的 ) 设置 Sublime Text 3 为 Python 进行类型检查 sublime GANs N’ Roses machine learning Imagine one day wherein we had a neural network which could watch movies and generate it’s own movies, or listen to songs and compose new ones. This network would learn from what it sees and hears without you explicitly telling it. This way of letting a neural network learn is known as unsupervised learning. (是也乎: 无监督学习系统的嗯哼 ) PyPy 究竟是什么? pypy PyBay 奖学金计划发布 conference In the spirit of increasing the Python community’s inclusivity and diversity, PyBay is pleased to announce this year’s conference scholarships. Our scholarships are designed to support members of our community for whom attending PyBay would present a financial challenge. 开始 Jupyter Notebook 的5个最佳技巧 jupyter We’ve discussed a few reasons to use Jupyter Notebooks as a GIS user. From visualization of your data to the recent integration with the ArcGIS platform, Jupyter Notebooks are quickly becoming a crucial component of GIS and data science workflows. In spite of these benefits, coming up to speed and getting comfortable with Jupyter Notebooks can be a daunting task for a new user. There is nuance to the way Jupyter Notebooks operate that can take some time to comprehend. (是也乎: 简单的说 ipynb 不是 IDE 也不是编辑器, 而是一个能方便的记录并同时积累我们思考的环境 ) 机器学习和深度学习工程师的基础作弊书 machine learning CheatSheets for Pandas, numpy etc. collections.Counter - Weekly Python Chat counter You want to count the number of times each thing occurs in your list. How do you do it? We’ll talk about the many ways to solve this problem, concluding with the most Pythonic way: Counter. scrapy 中的 404 链接检测器 code snippets 高级 Python 功能 core-python 好物 ~ 包/模块/库/片段… ...

2017-07-07 · 3 min · 1012 words · ZoomQuiet

蠎加载 131

原文: Import Python Weekly Newsletter - Issue No 131 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 将 Python 语法编译为 x86-64 指令集只为好玩并无增益 AST I used Python’s built-in AST module to parse a subset of Python syntax and turn it into an x86-64 assembly program. It’s basically a toy, but it shows how easy it is to use the ast module to co-opt Python’s lovely syntax for your own ends. (是也乎: 简单的说, 就是内置 AST 能力的嗯哼… ) 如何在 Python 中设立基准性能 performance Suppose that you have a function and you wonder, “Can I make this faster?” Well, you might already have thought that and you might already have a theory. Or two. Or three. Your theory might be sound and likely to be right, but before you go anywhere with it you need to benchmark it first. Here are some tips and scaffolding for doing Python function benchmark comparisons. 几个俺开始用的新工具 curated list Note - Two, to be precise. Wasn’t aware of python-gist myself. 月度 PyPI: IPython, pytest, cryptography 和 NumPy pypi Monthly PyPI digest. 用 Python 和 Flask 进行图像上传和审核 flask Almost all applications contain images. Image moderation has become a necessity. We will see in this article how to moderate your images automatically. (是也乎: 基于 Realtime image moderation and nudity detection API - Sightengine 进行鉴黄… ) Kruskal 的算法可视化 algorithms Kruskal’s algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected garph. Visualisation and code snippet included. 在 Python 基于贝叶斯进行 AB 测试 A/B-Testing Back when I was getting started into Bayesian Statistics I found it hard to find some simple ready-to-use code examples to get started with probabilistic programming. Today, there are great resources available and I want to contribute with that sharing a very simple code to get started with AB Tests in Python. 使用 nose 以及 coverage 进行 Django 测试 django, testing Django testing using django-nose and coverage. 用 scikit-learn, AWS Lambda, S3 和 Amazon API Gateway 构建接口 scikit, s3, lamda This tutorial will help you build a classifier as a service. The classifier will be trained using iris flower data set witch consists on 3 different types of irises’ (Setosa, Versicolour, and Virginica). The rows being the samples and the columns being features: sepal length, sepal width, petal length and petal width. Scikit-learn library will be used for machine-learning algorithms. (是也乎: 看起来很复杂, 但是, AWS 就是这样将元能力嗯哼好, 大家就可以自在的组合成各种嗯哼… ) logzero - 简化 Python 2 和 3 的 logging logging I’ve just published logzero, a small Python package which simplifies logging with Python 2 and 3. It is easy to use and robust, and heavily inspired by the Tornado web framework. (是也乎: 冲这么嗯哼的 logo 就可以尝试了.. ) 使用 PyFolio,R 的 PerformanceAnalytics 和 backtrader 进行股票交易分析优化 stock trading Curator - If you ever dreamed of writing code that makes you money while you sleep or are relaxing on a beach. On a serious note this is a solid blog post on stock reading Stock Performance analytics. CPython 和 MicroPython 中的内存应用 micropython At PyCon 2017, Kavya Joshi looked at some of the differences between the Python reference implementation (known as “CPython”) and that of MicroPython. In particular, she described the differences in memory use and handling between the two. Those differences are part of what allows MicroPython to run on the severely memory-constrained microcontrollers it targets—an environment that could never support CPython. (是也乎: 嗯哼?哲学一切都和设计哲学取舍有关… ) 好物 ~ 包/模块/库/片段… ...

2017-07-01 · 3 min · 1205 words · ZoomQuiet