蠎加载 161

原文: Import Python Weekly Newsletter - Issue No 161 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… “装饰器模式” 以及 Python “wrapt” 模块. wrapt Brandon Rhodes published a post today about the Decorator Pattern and how that translates into Python. He explains the manual way that the pattern can be implemented in Python as a wrapper, as well as how you can try to minimise the amount of work you need to do by overriding special methods of a Python object. The wrapt package I authored was purpose built for this task of creating wrappers which Brandon describes, and much more. To avoid some of the name confusion around Decorator Pattern versus Python decorators, which Brandon highlights as an issue, I tend to refer to the wrappers as transparent object proxies. (是也乎: 叕一个对原生特性增强的模块,来自 Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely. - YouTube https://www.youtube.com/watch?v=GCZmGgtWi3M NZPyUG 的年度大会 KiwiPyCon 2017… 14年就发布的老梗, 作者还在一直讲… ) 预测第一投手的薪水 data science, jupyter Today’s post focuses on applying linear regression techniques to a less-than-ideal dataset. In order to do so, I need a scenario from which to work. As of this writing, the MLB free agent signing period (or ‘Hot Stove’ as it is affectionately named) is in full effect. Therefore, I chose the following problem statement as my challenge: my client, a professional baseball team, is interested in offering a contract to a free agent starting pitcher and wants a recommendation for the annual salary it should propose. Now that I have my problem, I can begin working on the answer! (是也乎: 线性回归技术的一个真实案例 ) 用 AWS Lambda 来爬取数千产品 Selenium, lamda, chromedriver Or how to run Headless Chrome on AWS Lambda together with Python, Selenium and Chromedriver (是也乎: 无头 Chrome 的又一个嗯哼案例 ) Zulko/moviepy: 用Python编辑视频 video MoviePy (full documentation) is a Python library for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery for some examples of use. (是也乎: MoviePy 的确是一个完备的视频折腾工具, 可以说是 FFmpeg 的 Pythonic 包装 ) Django — Asset compression and Storages django The problem was, once we change something in the CSS/JS, that change was not getting reflected on the client side and browser was taking the old files from the cache. To avoid this, we needed a mechanism to refresh the cache once anything has changed in the CSS/JS. The obvious approach was to change the name or attach a version number to a CSS file each time we make a change. But we wanted this process to be automated so we came across Django-compressor. 在 Windows,Mac 和 Linux 上处理文件路径的简单方法 core-python Python 3.4 introduced a new standard library for dealing with files and paths called pathlib?—?and it’s great! (是也乎: Py3 的软文叕一则 ) Jupyter Notebook 技巧来提高 Data Science 效率 jupyter (是也乎: 叕一则 Jupyter 的数据科学嗯哼技巧 ) 用 Bounter pt. 2 有效地计数: CountMinSketch counter In my previous post on the new open source Python Bounter library we discussed how we can use its HashTable to quickly count approximate item frequencies in very large item sequences. Now we turn our attention to the second algorithm in Bounter, CountMinSketch (CMS), which is also optimized in C for top performance. Reportlab: 用 Python 进行 PDF 处理 ~ Mike Driscoll — Kickstarter kickstarter Learn how to create PDFs using the popular Python programming language and the ReportLab toolkit. Kickstarter campaign. gist-evernote project, gist, evernote A Python application that sync Github Gists and save them to Evernote notebook as screenshots. Python 中监督机器学习算法 machine learning The main goal of this reading is to understand enough statistical methodology to be able to leverage the machine learning algorithms in Python’s scikit-learn library and then apply this knowledge to solve a classic machine learning problem. The first stop of our journey will take us through a brief history of machine learning. Then we will dive into different algorithms. On our final stop, we will use what we learned to solve the Titanic Survival Rate Prediction Problem. 用 Python 解压缩 zip 文件的最快方法 code snippet, zip So the context is this; a zip file is uploaded into a web service and Python then needs extract that and analyze and deal with each file within. In this particular application what it does is that it looks at the file’s individual name and size, compares that to what has already been uploaded in AWS S3 and if the file is believed to be different or new, it gets uploaded to AWS S3. (是也乎: 不是不用解压缩就能使用所有内容的嘛? ) 好物 ~ 包/模块/库/片段… ...

2018-01-31 · 4 min · 1661 words · ZoomQuiet

蠎加载 160

原文: Import Python Weekly Newsletter - Issue No 160 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Python 折腾: 如果 None 在等式左边? core-python A natural default, None is probably the most commonly assigned value in Python. But what happens if you move it to the left side of that equation? (是也乎: 经典不折腾要死星人的游戏… ) 理解 Python 类内部 core-python The goal of this series is to describe internals and general concepts behind the class object in Python 3.6. In this part, I will explain how Python stores and lookups attributes. I assume that you already have a basic understanding of object-oriented concepts in Python. (是也乎: 叕一次尝试嗯哼 class 的行为 ) 如何将 PyLint 集成到自己的 PyCharm 工作流 ? pycharm PyCharm has it’s own built-in linting, which is already useful and nicely integrated. However, it misses much that PyLint catches. In this post I explain how I integrate PyLint into PyCharm as an external tool, with links from the PyLint results back to the python file. (是也乎: 叕一个 PyLint 技巧 ) 使用 Python 进行哈佛大学研究课程 - MOOC course Take your introductory knowledge of Python programming to the next level and learn how to use Python 3 for your research. (是也乎: 叕一个春虅大学的 MOOC ) 用 Tensorflow 对象检测在 Android 上检测皮卡丘 tensorflow Deep inside the many functionalities and tools of TensorFlow, lies a component named TensorFlow Object Detection API. The purpose of this library, as the name says, is to train a neural network capable of recognizing objects in a frame, for example, an image. (是也乎: Pikachu 已经正式成为现实世界物种了? ) 集群上的分布式 Pandas 中折腾 Dask DataFrames pandas Dask Dataframe extends the popular Pandas library to operate on big data-sets on a distributed cluster. We show its capabilities by running through common dataframe operations on a common dataset. (是也乎: 叕叕叕又一个 Dataframe 的嗯哼, 这次分布式了… ) Pangeo: 云上的 JupyterHub, Dask, 以及 XArray geo A few weeks ago a few of us stood up pangeo.pydata.org, an experimental deployment of JupyterHub, Dask, and XArray on Google Container Engine (GKE) to support atmospheric and oceanographic data analysis on large datasets. This follows on recent work to deploy Dask and XArray for the same workloads on super computers. This system is a proof of concept that has taught us a great deal about how to move forward. This blogpost briefly describes the problem, the system, then describes the collaboration, and finally discusses a number of challenges that we’ll be working on in coming months. (是也乎: Jupyter 的生态越来越丰富了… ) pyclbr core-python, packages pyclbr can scan Python source to find classes and stand-alone functions. The information about class, method, and function names and line numbers is gathered using tokenize without importing the code. (是也乎: 这个可以有 ;-) Py3 内建模块的工程支持工具. 再结合 Graphviz 就是工程代码图谱了… ) Python 3.7 数据类简介 core-python, 3.7 A Brand-new feature in Python 3.7 is “Data Classes”. Data classes are a way of automating the generation of boiler-plate code for classes which store multiple properties. (是也乎: 多重属性类的生成 ) Learn Leap Fly: 用 Python 和 Kjell Wooding 提升全球读写能力 – Episode 145 – Podcast.init podcast Learning how to read is one of the most important steps in empowering someone to build a successful future. In developing nations, access to teachers and classrooms is not universally available so the Global Learning XPRIZE serves to incentivize the creation of technology that provides children with the tools necessary to teach themselves literacy. Kjell Wooding helped create Learn Leap Fly in order to participate in the competition and used Python and Kivy to build a platform for children to develop their reading skills in a fun and engaging environment. In this episode he discusses his experience participating in the XPRIZE competition, how he and his team built what is now Kasuku Stories, and how Python and its ecosystem helped make it possible. (是也乎: Kivy 构建的教育支持平台… ) 用 Python 进行 Linux 系统挖掘 platform module In this article, we will explore the Python programming language as a tool to retrieve various information about a system running Linux. Let’s get started. (是也乎: Glance 你值得拥有… ) Google Colab Free GPU 教程 pytorch Now you can develop deep learning applications with Google Colaboratory -on the free Tesla K80 GPU- using Keras, Tensorflow and PyTorch. (是也乎: Google 全家桶也支持 PyTorch 了… ) 在 TensorFlow 中使用 tf.Print() tensorflow Today I’ll show how TensorFlow’s print statements work, and how to make the most of them, hopefully saving you some confusion along the way. 在Python中处理时间戳和时区转换 datetime 好物 ~ 包/模块/库/片段… ...

2018-01-27 · 4 min · 1535 words · ZoomQuiet

蠎加载 159

原文: Import Python Weekly Newsletter - Issue No 159 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 如何加速 Python 应用程序的启动时间? processing time Python 3.7 has new feature to show time for importing modules. This feature is enabled with -X importtime option or PYTHONPROFILEIMPORTTIME environment variable. (是也乎: Py3.7 果断划出很多精力来提升速度 ) 使用文本分析来量化角色 NLTK If you’ve ever worked on a text and wished you could get a list of characters or see how many times each character was mentioned, this is the tutorial for you. (是也乎: NLP 基础分析需求叕一次工具化 ) 在 asyncio 应用程序中寻找内存泄漏 memory leaks, async Sailing into the last two weeks of 2017 that I fully intended to spend experimenting with various eggnog recipes. I was alerted by our DevOps team that our asyncio app was consuming 10GB of memory. That is approximately 100 times more than it should! (是也乎: 等等, Python 也有内存嗯哼问题? 一个从 10亿回到100M 的故事 ) DjangoCon JP 2018 conference DjangoCon JP is a conference for the Django Web framework in Japan. If you’re a seasoned Django pro or just starting, DjangoCon JP is for you. Our goal is for atendees to meet, talk, share tips, discover new ways to use Django, and, most importantly, have FUN. (是也乎: 国外的技术大会世家都是年初, 中国的在年尾…所以, 基于文化还是经济原因呢? ) 路径 flat 即功成 code-quality If you want to write clear and easy to understand software, make sure it has a single success path. A ‘single success path’ means a few things. First, it means that any given function/method/procedure should have a single clear purpose. (是也乎: 很久没有见这种代码品质的经验讨论了… ) 规范化流程教程,第1部分:分布和决定因素 tensorflow This series is written for an audience with a rudimentary understanding of linear algebra, probability, neural networks, and TensorFlow. Knowledge of recent advances in Deep Learning, generative models will be helpful in understanding the motivations and context underlying these techniques, but they are not necessary. 预制 Docker 镜像基于 GPU 来 OpenAI Gym 开发和 TensorFlow docker, tensorflow So, you want to write an agent, competing in the OpenAI Gym, you want to use Keras or TensorFlow or something similar and you don’t want everything installed on your workstation? You have come to the right place! (是也乎: 随着 tensorflow 工具链的增长,这个 Docker 的体积当然的将越来越嗯哼 ) 用 Python 检查 Coinbase 中收支平衡 coinbase Even though Coinbase has a mobile application so you’re able to check your balance on the go, I prefer using their API instead so I can setup custom alerts not available on their platform. (是也乎: Coinbase, 哈, 一看名字就知道是相关什么 ) 使用 bower 通过 Django 管理静态文件 django Sharing a way to manage libraries like bootstrap, jquery with bower without using any external app. (是也乎: 所以, PHP 发明之初就内置的工具, Django 一直在嗯哼 ) 自动模型选择:H2O AutoML modeling In this post, we will use H2O AutoML for auto model selection and tuning. This is an easy way to get a good tuned model with minimal effort on the model selection and parameter tuning side. (是也乎: 叕一个 AI 框架. ) Python 中的逻辑回归 sklearn 好物 ~ 包/模块/库/片段… ...

2018-01-19 · 4 min · 1513 words · ZoomQuiet

蠎加载 158

原文: Import Python Weekly Newsletter - Issue No 158 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 掌握 PyCharm pycharm Do you use PyCharm as your Python IDE?. Then this course might be of interest to you. Taught by Michael of TalkPython podcast fame. (是也乎: 总是说一个工具复杂到要出书来学习使用时, 就得谨慎了… ) 如何使用VS Code和Jupyter Notebook改善您的工作流程 jupyter, visualstudio I love VS Code and I love Jupyter Notebooks. Both excel at their own world. But to improve my workflow I had to create a bridge between their worlds. (是也乎: 在 IPy:NB 中可以完成的任务, 导入 VSCode 后, 也就能看看,并不能交互那有什么用? ) Luciano Ramalho 曰 Python 功能和库 - O’Reilly Media podcast The O’Reilly Programming Podcast: A look at some of Python’s valuable, but often overlooked, features. (是也乎: O’Reilly 也在用 Py ) 开始使用 Anaconda Python, 数据科学的发行版 anaconda It provides a management GUI, a slew of scientifically oriented work environments, and tools to simplify the process of using Python for data crunching (是也乎: 内什么, anaconda 的问题不在安装, 而在生产.. ) 介绍 Python Ensembles machine learning Ensembles have rapidly become one of the hottest and most popular methods in applied machine learning. Virtually every winning Kaggle solution features them, and many data science pipelines have ensembles in them. Put simply, ensembles combine predictions from different models to generate a final prediction, and the more models we include the better it performs. Better still, because ensembles combine baseline predictions, they perform at least as well as the best baseline model. Ensembles give us a performance boost almost for free! (是也乎: Ensembles ~ 合奏,叕一个 ML 框架 简单的说将常用的一堆算法用统一的界面管理了起来. ) 新 Python 库用于分析 skeleton 图像协助分析红血球膜 skeleton 特征来确认疟疾寄生虫 scipy We present Skan (Skeleton analysis), a Python library for the analysis of the skeleton structures of objects. It was inspired by the “analyse skeletons” plugin for the Fiji image analysis software, but its extensive Application Programming Interface (API) allows users to examine and manipulate any intermediate data structures produced during the analysis. Further, its use of common Python data structures such as SciPy sparse matrices and pandas data frames opens the results to analysis within the extensive ecosystem of scientific libraries available in Python. (是也乎: Skan的推荐.. ) K-Means 聚类与 Scikit-learn machine learning, scikit K-means clustering is a simple yet very effective unsupervised machine learning algorithm for data clustering. It clusters data based on the Euclidean distance between data points. K-means clustering algorithm has many uses for grouping text documents, images, videos, and much more. (是也乎: 叕一则用 scikit 折腾 K-Means 的嗯哼 ) Python 发布 Python 3.7.0a4 new release This is an early developer preview of Python 3.7 (是也乎: Py3 在加速, 想来 2020 年也不远了…不过, Py2 的寿命远远不是官方说了算的.. ) 如何用 Python 绘制 Renko 图表? renko Renko charts are time independent and are efficient to trade as they eliminate noise. In this article we see how to plot renko charts of any instrument with OHLC data using Python. (是也乎: pandas+matplotlib 就嗯哼了. ) 用 Python 基于 Google Cloud Speech API 将语音转录成文本 audio This tutorial will walk through using Google Cloud Speech API to transcribe a large audio file. (是也乎: 叕一个 Google 语音接口的包装库, 只是少年, 在中国无法直接用哪… 当然, 多年前开始, Youtube 就已经大规模使用此服务来自动生成各种演讲字幕了, 而且速度越来越快,当前已经可以作到准实时了… 对比国内的讯飞, 投入的研发时间还要长, 可惜… ) tirthajyoti/PythonMachineLearning data science, machine learning Essential codes for jump-starting machine learning/data science with Python. (是也乎: 叕一则 DC~数据科学入门教程 ) Python 中的时间序列分析 numpy, time series Additive models for time series modeling 我如何用20行以内 Python 代码生成正能量语句? markov chain When it comes to natural language generation, people normally think of advanced AI systems using advanced mathematics; however, that is not always true. In this post, I will be using the idea of Markov chains and a small dataset of quotes to generate new quotes. (是也乎: 叕一则 20行 AI 案例…哈哈.. ) 使用 Python 生成器来爬星球大战 API generators In this lesson, you will be introduced to Python generators. You will see how a generator can replace a common function and learn the benefits of doing so. You will learn what role the yield keyword provides in functions and how it differs from a return. Building on that knowledge, you will learn how to build a generator to recursively crawl an API (swapi.co) and return Star Wars characters from “The Force Awakens”. Python 中关键字和常量之间的差异 core-python 好物 ~ 包/模块/库/片段… ...

2018-01-14 · 4 min · 1725 words · ZoomQuiet