- Feb 2020
-
course.spacy.io course.spacy.io
-
In spaCy, attributes that return strings usually end with an underscore – attributes without the underscore return an ID.
Spacy: atributos con y sin , como por ejemplo pos_ y id
-
-
www.fastcompany.com www.fastcompany.com
-
“Python is now the new glue language,”
I head this exact phrase at a Python meetup this week along with a slide
Python >= glue
.
-
- Jan 2020
-
www.techrepublic.com www.techrepublic.com
-
Well, why don't I create my own language', stealing my ideas from ABC
-
reducing the project size from something that took three years to complete to something I can do on my own, as a skunk works project in three months
first sighting of: skunkworks project
-
-
- Dec 2019
-
stackoverflow.com stackoverflow.com
-
Werkzeug provides a development server: a simple web server that you can run with a single command and almost no configuration. When you do flask run (or werkzeug.serving.run_simple()), this development server is what you are getting
-
-
github.com github.com
-
github.com github.com
-
Superseded by (replacement project): https://github.com/QTodoTxt/QTodoTxt2/
Before I realized there was a replacement project:
Blah. Looks good but unmaintained. Too many competing forks.
Other interesting fork: https://github.com/kmicc/QTodoTxt/tree/dev
This branch is 17 commits ahead, 201 commits behind QTodoTxt:dev. https://github.com/QTodoTxt/QTodoTxt/compare/master...kmicc:dev https://github.com/kmicc/QTodoTxt/network
-
-
github.com github.com
-
HTTPretty
Use this to mock the request object so that it will be easier to mock the request context manager.
Tags
Annotators
URL
-
- Nov 2019
-
realpython.com realpython.com
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
import operator s = sorted(s, key = operator.itemgetter(1, 2))
Sort by multiple indexes.
-
to reverse to only one attribute, you can sort twice: first by the secondary s = sorted(s, key = operator.itemgetter(2)) then by the primary s = sorted(s, key = operator.itemgetter(1), reverse=True)
This makes sense, particularly from specification of sort order in Pandas, if I recall correctly you usually specify the primary last which makes me think on the backend implementation it does something similar to this where it sorts from the lowest priority to the highest priority.
-
-
github.com github.com
Tags
Annotators
URL
-
- Oct 2019
-
stackoverflow.com stackoverflow.com
-
One of my favorite languages that I have had the pleasure to use is Python. Python supports named parameters without any trickery.... Since I started using Python (some time ago) everything became easier. I believe that every language should support named parameters, but that just isn't the case.
-
-
pandas.pydata.org pandas.pydata.org
-
Indicate number of NA values placed in non-numeric columns.
This is only true when using the Python parsing engine.
Filled 3 NA values in column name
If using the C parsing engine you get something like the following output:
Tokenization took: 0.01 ms Type conversion took: 0.70 ms Parser memory cleanup took: 0.01 ms
-
-
automatetheboringstuff.com automatetheboringstuff.com
-
def getAnswer(answerNumber):
先要定义一个函数,后面才能调用
-
expression
比如:
return 3 + 5 # 8
Tags
Annotators
URL
-
-
developers.google.com developers.google.com
-
I can't make an annotation on Google's documentation ( I think it's a Hypothesis bug ) but I've updated the linked code sample below to work as of 10/04/2019 with Python 3
https://gist.github.com/technoplato/4d28f4f308ea7c5fe20bd23e751e9e60
-
- Sep 2019
-
passlib.readthedocs.io passlib.readthedocs.io
-
Passlib mitigates this by limiting the maximum password size to 4k by default.
Looks like MAX_PASSWORD size is set at 4k.
-
-
julien.danjou.info julien.danjou.info
-
Which works fine, but make you use lambda. You could rather use the operator module:import operator mylist = list(zip(range(40, 240), range(-100, 100))) sorted(mylist, key=operator.itemgetter(1))
-
-
docs.pytest.org docs.pytest.org
-
Good Integration Practices
Tags
Annotators
URL
-
-
www.cloudcity.io www.cloudcity.io
-
py27-django{18,19,110,111,111tip},
An example of how to test multiple python versions against multiple library versions
-
- Aug 2019
-
-
This is useful for mapping objects created in Python to their memory usage.
-
-
guilload.com guilload.com
-
intern
sys.intern in Python3
-
ascii letters, digits or underscores
String composed of these characters are interned. Aka the following will not be interned:
f = 'f o'
but the following will be interned:
f = 'f_o'
-
sequences generated through peephole optimization are discarded if their length is superior to 20
So values generated via peephole optimization above 20 are not 'pre-computed' but left as is:
'a' * 21 # remains in the byte code where as 'a' * 20 # gets converted to 'aaaaaaaaaaaaaaaaaaaa'
-
string subclasses cannot be interned
Meaning
class NewString(str): pass assert NewString('f') is 'f'
Will fail. Where as:
f = 'f' assert f is 'f'
Will pass.
This is presents a case for not building custom string types in Python as it breaks the string cache and can result in a performance hit.
-
strings can be compared by a O(1) pointer comparison instead of a O(n) byte-per-byte comparison
This is a huge advantage. Not only does it save memory by not duplicating simple and common string values, but the comparison method has an early exit that compares the pointers instead of the values. aka in sudo-code form:
// compare pointers if self._value is value: return True // compare values for i, v in enumerate(self._value): if v != value[i]: return False return True
Tags
Annotators
URL
-
-
gist.github.com gist.github.com
-
www.geeksforgeeks.org www.geeksforgeeks.org
-
classmethod vs staticmethod eg
-
- Jul 2019
-
git.dhimmel.com git.dhimmel.com
-
hetio
The
hetio
python package has been renamed tohetnetpy
and is now available at https://github.com/hetio/hetnetpy.
Tags
Annotators
URL
-
-
www.nature.com www.nature.com
-
On 10 April, astrophysicists announced that they had captured the first ever image of a black hole. This was exhilarating news, but none of the giddy headlines mentioned that the image would have been impossible without open-source software. The image was created using Matplotlib, a Python library for graphing data, as well as other components of the open-source Python ecosystem. Just five days later, the US National Science Foundation (NSF) rejected a grant proposal to support that ecosystem, saying that the software lacked sufficient impact.
This story raises the question "From the funding point of view, what is reproducible research?".
Tags
Annotators
URL
-
- Jun 2019
-
github.com github.com
-
while number:
This is where pyramid_tm retries transaction.interfaces.TransientError.
-
-
docs.pylonsproject.org docs.pylonsproject.org
-
get_current_request()
This can be used to get the current request object if the request object is not already available in the current context. It really shouldn't be used in production code but in a debug/test scenario it can be quite handy.
-
-
lerner.co.il lerner.co.il
-
Corporate training Introduction to Python Advanced Python Python for non-programmers Data science and machine learning in Python Python for system administrators Python Practice Workshop Regular expressions Introduction to Git Online training Weekly Python Exercise NumPy Intro Python: Fundamentals Object-oriented Python Comprehending Comprehensions Understanding and mastering Git Python Workout Practice Makes Regexp Free e-mail courses Regular expressions crash course Boolean indexing in NumPy and Pandas Variable scoping in Python Working with files in Python Teach programming better Blog About Reuven Home → Blog →Python →Why do Python lists let you += a tuple, when you can’t + a tuple? 1 Why do Python lists let you += a tuple, when you can’t + a tuple? Let’s say you have a list in Python: >>> mylist = [10, 20, 30] You want to add something to that list. The most standard way to do this is with the “append” method, which adds its argument to the end of the list: >>> mylist.append(40) >>> print(mylist) [10, 20, 30, 40] But what if you want to add multiple items to a list? If you’re new to Python, then you might think that you can and should use a “for” loop. For example: >>> mylist = [10, 20, 30] >>> new_items = [40, 50, 60] >>> for one_item in new_items: mylist.append(one_item) >>> print(mylist) [10, 20, 30, 40, 50, 60] Great, right? But it turns out that there is a smarter and faster way to do this. You can use the += operator. This operator, which invokes the “iadd” (“inplace add”) method on the object to its left, effectively does what we did above, but in much less code: >>> mylist = [10, 20, 30] >>> new_items = [40, 50, 60] >>> mylist += new_items >>> print(mylist) [10, 20, 30, 40, 50, 60] It’s not a huge surprise that += can do this. After all, we normally expect += to add and assign to the variable on its left; it works with numbers and strings, as well as other types. And we know that we can use the + operator on lists, too: >>> [1, 2, 3] + [4, 5, 6] [1, 2, 3, 4, 5, 6] Can we join a list and a tuple? Let’s check: >>> mylist = [10, 20, 30] >>> t = (40, 50, 60) >>> mylist + t Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate list (not "tuple") to list In other words: No. Trying to add a list and a tuple, even if we’re not affecting either, results in the above error. Which is why it’s so surprising to many of my students that the following does work: >>> mylist = [10, 20, 30] >>> t = (40, 50, 60) >>> mylist += t >>> mylist [10, 20, 30, 40, 50, 60] That’s right: Adding a list to a tuple with + doesn’t work. But if we use +=, it does. What gives? It’s common, when teaching Python, to say that x += 5 is basically a rewrite of x = x + 5 And in the majority of cases, that’s actually true. But it’s not always true. Consider: When you say “x + y” in Python, the “+” operator is translated into a method call. Behind the scenes, no matter what “x” and “y” are, the expression is translated into: x.__add__(y) The “__add__” magic method is what’s invoked on an object when it is added to another object. The object on the right-hand side of the “+” is passed as an argument to the method, while the object on the left-hand side is the recipient of the method call. That’s why, if you want your own objects to handle the “+” operator, you need to define the “__add__” method in your class definition. Do that, and things work just fine. And thus, when we say “x = x + 5”, this is turned into x = x.__add__(5) Meaning: First invoke the method, and then assign it back to the variable “x”. In this case, “x” isn’t changing; rather, the variable is now referencing a new object. Now consider the “+=” operator: It’s translated by Python into “__iadd__”, short for “inplace add.” Notice the slightly different syntax that we use here: x += y is translated into x.__iadd__(y) Did you see the difference between __add__ and __iadd__? The latter executes the assignment all by itself, internally. You don’t have to capture its output and assign it back to x. It turns out that the implementation of list.__iadd__ takes the second (right-hand side) argument and adds it, one element at a time, to the list. It does this internally, so that you don’t need to execute any assignment after. The second argument to “+=” must be iterable; if you say mylist += 5 you will get an error, saying that integers are not iterable. But if you put a string, list, tuple, or any other iterable type on the right-hand side, “+=” will execute a “for” loop on that object, adding each of its elements, one at a time, to the list. In other words: When you use + on a list, then the right-hand object must be a list. But when you use +=, then any iterable type is acceptable: >>> mylist = [10, 20, 30] >>> mylist += [40, 50] # list >>> mylist [10, 20, 30, 40, 50] >>> mylist += (60, 70) # tuple >>> mylist [10, 20, 30, 40, 50, 60, 70] >>> mylist += 'abc' # string >>> mylist [10, 20, 30, 40, 50, 60, 70, 'a', 'b', 'c'] >>> mylist += {'x':1, 'y':2, 'z':3} # dict! >>> mylist [10, 20, 30, 40, 50, 60, 70, 'a', 'b', 'c', 'x', 'y', 'z'] Does this work with other types? Not really. For example: >>> t = (10, 20, 30) >>> t += [40, 50] Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate tuple (not "list") to tuple What happened here? Let’s check the definition of tuple.__iadd__ to find out: >>> help(tuple.__iadd__) Traceback (most recent call last): File "", line 1, in AttributeError: type object 'tuple' has no attribute '__iadd__' Wait a second: There is no “__iadd__” method for tuples? If so, then how can “+=” work at all? Because Python tries to be smart in such cases: If the object implements “__iadd__”, then the “+=” operator invokes it. But if the object lacks an “__iadd__” implementation, then Python does what we all guess it normally does — namely, invoke “__add__”, and then assign the results back to the variable. For example: >>> class Foo(object): def __init__(self, x): self.x = x def __add__(self, other): print("In __add__") return Foo(self.x + other.x) >>> f1 = Foo(10) >>> f2 = Foo(20) >>> f1 += f2 In __add__ >>> vars(f1) {'x': 30} In other words, Python notices that our Foo class lacks an implementation of “__iadd__”, and substitutes “__add__” for it, assigning its result (a new instance of Foo) to the original variable.
-
- Apr 2019
-
-
#!/usr/bin/env python3 import configparser import os import sys from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By config = configparser.ConfigParser() config.read("config.ini") chrome_options = Options() chrome_options.add_argument("--headless") driver = webdriver.Chrome(executable_path=os.path.abspath("/usr/local/bin/chromedriver"), chrome_options=chrome_options) driver.get("https://fastmail.fm") timeout = 120 try: element_present = EC.presence_of_element_located((By.NAME, 'username')) WebDriverWait(driver, timeout).until(element_present) # Send login information user = driver.find_element_by_name("username") passwd = driver.find_element_by_name("password") user.send_keys(config["default"]["user"]) passwd.send_keys(config["default"]["pass"]) driver.find_element_by_class_name("v-Button").click() print("Logged in") # wait for login to complete element_present = EC.presence_of_element_located((By.CLASS_NAME, 'v-MainNavToolbar')) WebDriverWait(driver, timeout).until(element_present) # click settings menu to make elements visible driver.find_element_by_class_name("v-MainNavToolbar").click() # And follow to settings page driver.find_element_by_link_text("Settings").click() # Wait for settings page to render, oh Javascript element_present = EC.presence_of_element_located((By.LINK_TEXT, 'Rules')) WebDriverWait(driver, timeout).until(element_present) # Click on Rules link driver.find_element_by_link_text("Rules").click() # Click on edit custom sieve code element_present = EC.presence_of_element_located((By.LINK_TEXT, 'Edit custom sieve code')) WebDriverWait(driver, timeout).until(element_present) driver.find_element_by_link_text("Edit custom sieve code").click() print("Editing") # This is super unstable, I hate that we have to go by webid element_present = EC.presence_of_element_located((By.CLASS_NAME, 'v-EditSieve-rules')) WebDriverWait(driver, timeout).until(element_present) print("Find form") elements = driver.find_elements_by_css_selector("textarea.v-Text-input") element = elements[-1] # Find the submit button elements = driver.find_elements_by_css_selector("button") for e in elements: if "Save" in e.text: submit = e print("Found form") # And replace the contents element.clear() with open("rules.txt") as f: element.send_keys(f.read()) # This is the Save button print("Submitted!") submit.click() except TimeoutException as e: print(e) print("Timed out waiting for page to load") sys.exit(0) print("Done!")
-
-
hplgit.github.io hplgit.github.iobook.pdf1
-
This book gets lots of praise
-
- Mar 2019
- Feb 2019
-
venturebeat.com venturebeat.com
-
Python is currently the most popular language used by developers working on machine learning projects, according to GitHub’s recent Octoverse report
-
-
tanthiamhuat.files.wordpress.com tanthiamhuat.files.wordpress.com
-
stockrt.github.io stockrt.github.io
-
realpython.com realpython.com
-
The Ultimate Guide to Python Type Checking
Tags
Annotators
URL
-
-
mypy.readthedocs.io mypy.readthedocs.io
-
Type hints cheat sheet (Python 3)¶ This document is a quick cheat sheet showing how the PEP 484 type annotation notation represents various common types in Python 3.
-
- Jan 2019
-
www.mathworks.com www.mathworks.com
-
MIT “MATLAB is the language used by virtually every team in the world that designs gravitational wave detectors… I look forward to exploring the data from each new detection in MATLAB.” Matthew Evans, Assistant Professor of Physics
Not the ones who receive Nobel prizes: https://newscenter.lbl.gov/2017/10/03/berkeley-lab-tools-helped-ligo-nobel-physics/
Tags
Annotators
URL
-
-
www.sciencedirect.com www.sciencedirect.com
-
KNIME includes Python in various processing nodes for data processing, model learning and prediction, and the generation of visualizations.
-
- Dec 2018
-
stackoverflow.com stackoverflow.com
- Nov 2018
-
blog.csdn.net blog.csdn.net
-
大概就是Machine这个类里面维护比较重要的三个元素,States={},Events={}, models= []
Tags
Annotators
URL
-
- Oct 2018
-
www.paulgraham.com www.paulgraham.com
-
All you can do is send a message (AYCDISAM) = Actors model - there is no direct manipulation of objects, only communication with (or invocation of) them. The presence of fields in Java violates this.
from what I understand in Java... there are some variables on classes (class instances) that are only acessible through methods and for those the "only send message" paradigm holds but there are also fields which are like attributes in python which you can change directly
Tags
Annotators
URL
-
-
github.com github.com
Tags
Annotators
URL
-
-
planetpython.org planetpython.org
-
- Aug 2018
-
stackoverflow.com stackoverflow.com
-
Matplotlib different size subplots
-
-
-
matplotlib.pyplot.subplots_adjust
-
- Jul 2018
-
www.cleveroad.com www.cleveroad.com
- Jun 2018
-
stackoverflow.com stackoverflow.com
-
if you need to pull out these rows and examine them
-
-
www.anaconda.com www.anaconda.com
-
With over 6 million users, the open source Anaconda Distribution is the fastest and easiest way to do Python and R data science and machine learning on Linux, Windows and Mac OS X. It's the industry standard for developing, testing and training on a single machine
With over 6 million users, the open source Anaconda Distribution is the fastest and easiest way to do Python and R data science and machine learning on Linux, Windows and Mac OS X. It's the industry standard for developing, testing and training on a single machine
Tags
Annotators
URL
-
-
jupyter.org jupyter.org
-
Project Jupyter exists to develop open-source software, open-standards, and services for interactive computing across dozens of programming languages
Tags
Annotators
URL
-
- May 2018
-
blog.csdn.net blog.csdn.net
-
如果不在同一个package中,例如我们希望在module_21.py中调用module_11.py中的FuncA
from module_11包名.module_11 import funcA
Tags
Annotators
URL
-
-
www.cnblogs.com www.cnblogs.com
-
这两个函数都接收一个分割字符串作为参数,将目标字符串分割为两个部分,返回一个三元元组(head,sep,tail),包含分割符。细微区别在于前者从目标字符串的末尾也就是右边开始搜索分割符。
>>> "django.core.app".partition('.') ('django', '.', 'core.app') >>> "django.core.app".rpartition('.') ('django.core', '.', 'app')
Tags
Annotators
URL
-
-
blog.csdn.net blog.csdn.net
-
argarse.ArgumentParser.parse_known_args()解析
有时脚本可能只解析一些命令行参数,将剩下的参数传递给另一个脚本或程序。 在这种情况下,parse_known_args() 方法可能很有用。 它的工作方式与parse_args() 非常相似,只是在出现额外参数时不会产生错误。 相反,它会重新生成包含已填充名称空间和剩余参数字符串列表的两个项目元组。
import argparse parser = argparse.ArgumentParser() parser.add_argument( '--flag_int', type=float, default=0.01, help='flag_int.' ) FLAGS, unparsed = parser.parse_known_args() print(FLAGS) print(unparsed)
# python test.py --flag_int 1 --flag_bool True --flag_string 'haha, I get it' --flag_float 0.2 Namespace(flag_int=1.0) ['--flag_bool', 'True', '--flag_string', 'haha, I get it', '--flag_float', '0.2']
-
-
patsy.readthedocs.io patsy.readthedocs.io
-
one level is chosen as the “reference”, and its mean behaviour is represented by the intercept. Each column of the resulting matrix represents the difference between the mean of one level and this reference level
-
- Apr 2018
-
davidbpython.com davidbpython.com
-
Iterator Protocol
The protocol specifies methods to be implemented to make our objects iterable.
该协议指定了要实现我们的对象迭代的方法。
"Iterable" simply means able to be looped over or otherwise treated as a sequence or collection.
“可迭代”仅仅意味着能够循环或像对待序列或集合一样的方式处理。
-
Classes allow us to create a custom type of object -- that is, an object with its own behaviors and its own ways of storing data.
Introduction of Classes 类允许我们创建一个自定义类型的对象 - 也就是说,一个对象具有自己的行为和自己的存储数据的方式。
-
Packages provide for accessing variables within multiple files.
从package多文件访问变量的注意事项
-
A package is a directory of files that work together as a Python application or library module.
Introduction python packages
packages是一个文件目录,可以作为Python应用程序或库模块一起工作
-
Recursion features three elements
递归调用三要素:
- recursive call: 递归调用,这是函数对自己的调用;
- function process: 函数过程本身;
- base condition: 一个基本条件,这是递归链最终返回的点。
-
*args and **kwargs to capture all arguments
*args 和 **kwargs 可以代表所有参数
为了允许装饰函数接受参数,我们必须接受它们并将它们传递给装饰函数。
-
object: a data value of a particular type variable: a name bound to an object
什么是object -- 是一个具有类型的数据 什么是变量 -- 是一个绑定对象的名字
-
All programs named test_something.py that have functions named test_something()
pytest Basics
-
unit test: testing individual units (function/method) integration test: testing multiple units together regression test: testing to see if changes have introduced errors end-to-end test: testing the entire program
- 单元测试 -- 测试单个单元,方法
- 集成测试 -- 集中测试多个单元
- 回归测试 -- 测试修改有没有引入新的错误
- 端到端测试 -- 测试整个程序
-
pandas is a Python module used for manipulation and analysis of tabular data.
Introduction to Pandas
Pandas is used to manipulation and analysis of tabular data
-
pandas official documentation
pandas reference and tutorials include:full docs, 10minutes to pandas, blog tutorials
-
-
jupyterhub.readthedocs.io jupyterhub.readthedocs.io
-
JupyterHub, a multi-user Hub, spawns, manages, and proxies multiple instances of the single-user Jupyter notebook server.
Tags
Annotators
URL
-
-
mybinder.org mybinder.orgbinder1
-
Turn a GitHub repo into a collection of interactive notebooks
Tags
Annotators
URL
-
-
www.pythonanywhere.com www.pythonanywhere.com
-
Host, run, and code Python in the cloud!
Tags
Annotators
URL
-
-
geopandas.org geopandas.org
-
GeoPandas
Tags
Annotators
URL
-
-
python-visualization.github.io python-visualization.github.io
-
Folium
Tags
Annotators
URL
-
-
web.mit.edu web.mit.edu
-
What is music21?
¿Qué es Music21?
Music21 es un conjunto de herramientas para ayudar a los estudiantes de música y personas que escuchan la música de manera activa a resolver preguntas cómo: ¿Cuántas veces hace Bach eso? ¿cuándo fue la primera vez que determinada banda uso cierto orden de acordes?.
-
How simple is music21 to use?
¿Cómo usar Music21?
Después de instalar python y music21 usando pip u otro método, escribir en un archivo de texto: "from music21 import*" y luego puedes trabajar con todas las funciones que ofrece la biblioteca music21
Para mostrar una melodía en notación musical se escribe: converter.parse("tinynotation: 3/4 c4 d8 f g16 a g f#").show()
Tags
Annotators
URL
-
-
www.theatlantic.com www.theatlantic.com
-
At every turn, IPython chose the way that was more inclusive, to the point where it’s no longer called “IPython”: The project rebranded itself as “Jupyter” in 2014 to recognize the fact that it was no longer just for Python.
Such an interesting progression!
-
- Nov 2017
-
developers.500px.com developers.500px.com
-
runestone.academy runestone.academy
-
Compilers translate an entire program's source code before the program can run. Interpreters translate one line at a time but it doesn't mean that the compilation stage doesn't happen.
-
-
simonwillison.net simonwillison.net
-
At some point in the following decade json-head.appspot.com stopped working. Today I’m bringing it back, mainly as an excuse to try out the combination of Python 3.5 async, the Sanic microframework and Zeit’s brilliant Now deployment platform.
Oh neat, I had no idea now supported Python. Another option available!
-
- Oct 2017
-
docs.aws.amazon.com docs.aws.amazon.com
-
cs231n.github.io cs231n.github.io
-
c = np.full((2,2), 7) # Create a constant array print(c)
To avoid the warning, use
np.full((2,2), 7.) or use explicitly for float np.full((2,2),7, dtype=float) or for int np.full((2,2),7, dtype=int)
-
-
runestone.academy runestone.academy
-
new to Python
For newbies I can recommend video lectures by Charles Severence.
-
- Sep 2017
-
docs.python.org docs.python.org
-
However, unlike an ordinary loop, yield from allows subgenerators to receive sent and thrown values directly from the calling scope, and return a final value to the outer generator
This is the main usage of
yield from
.
Tags
Annotators
URL
-
-
www.spectralpython.net www.spectralpython.net
-
Spectral Python (SPy) is a pure Python module for processing hyperspectral image data. It has functions for reading, displaying, manipulating, and classifying hyperspectral imagery. It can be used interactively from the Python command prompt or via Python scripts
Tags
Annotators
URL
-
-
tw.gitbook.net tw.gitbook.net
-
PostgreSQL連接Python
python连接postgresql,非常简单,基本跟mylsql一样,通过cursor来执行
Tags
Annotators
URL
-
-
www.bkjia.com www.bkjia.com
-
Python 读写 txt 文本文件的操作方法全解析
-
- Jul 2017
-
www.datacamp.com www.datacamp.com
-
Learn Data Science Online
Data analysis courses using R and Python
Tags
Annotators
URL
-
-
runestoneinteractive.org runestoneinteractive.org
-
Runestone Interactive
Interactive textbooks on programming
-
- Jun 2017
-
lwn.net lwn.net
-
Shannon held up a BBC micro:bit board, which runs MicroPython and has been given to students in the UK, and noted that it only has 16KB of memory.
check out MicroPython
Tags
Annotators
URL
-
- May 2017
-
appscript.sourceforge.net appscript.sourceforge.net
-
Calling from Python As of 10.10, AppleScript can use Cocoa frameworks in any Script Editor-based script. This makes it easy for Python and other languages that have Objective-C bridges to call AppleScript directly, without having to package everything as an Xcode app. Stick one or more compiled .scpt files containing AppleScript-ObjC "classes" into a folder, e.g.: use framework "Foundation" use scripting additions script MyASClass property parent : class "NSObject" -- on test() activate display dialog "Hello from AppleScript!" end test end script then just use it from Python like this: from Foundation import NSBundle, NSClassFromString import AppleScriptObjC NSBundle.alloc().initWithPath_(FOLDERPATH).loadAppleScriptObjectiveCScripts() MyASClass = NSClassFromString(u"MyASClass") # get the ASOC class... MyASClass.alloc().init().test() # ...then instantiate and call it
Given that appscript is deprecated, I'm looking at how to call AppleScript directly from Python. This section is a "hello world" demonstration of how.
Tags
Annotators
URL
-
-
www.cdr-stats.org www.cdr-stats.org
Tags
Annotators
URL
-
-
pypi.python.org pypi.python.org
Tags
Annotators
URL
-
- Apr 2017
-
-
It is great to know that Python comes out on top as a more versatile language .
-
-
static1.squarespace.com static1.squarespace.com
-
1608 The essay "Rhetoric" that is reprinted here comes from Doing What Comes Nat-urally.
-
-
packaging.python.org packaging.python.org
-
Host your own library
Tags
Annotators
URL
-
- Mar 2017
-
blog.outsider.ne.kr blog.outsider.ne.kr
-
Prophet : Facebook에서 오픈 소스로 공개한 시계열 데이터의 예측 도구로 R과 Python으로 작성되었다.
python statics opensource, also can use R
Tags
Annotators
URL
-
- Feb 2017
-
static1.squarespace.com static1.squarespace.com
- Jan 2017
-
click.pocoo.org click.pocoo.org
-
However, remember that Click is Unicode-based, so the string will always be a Unicode value
Tags
Annotators
URL
-
-
interactivepython.org interactivepython.org
-
In Python, as well as in any other object-oriented programming language, we define a class to be a description of what the data look like (the state) and what the data can do (the behavior). Classes are analogous to abstract data types because a user of a class only sees the state and behavior of a data item. Data items are called objects in the object-oriented paradigm. An object is an instance of a class.
Class = General description of form and functions of data. Object = A member or instance of a class.
-
- Dec 2016
-
www.dataquest.io www.dataquest.io
-
In that case, you need an empty placeholder list that you can append items to individually.
这涉及到之后的关于automatioin的程序功能。programming最厉害的地方就在于automation。
Tags
Annotators
URL
-
- Nov 2016
-
media.readthedocs.org media.readthedocs.org
-
Mastodon.py Documentation
Python/API documentation for the Mastodon social networking platform.
-
- Sep 2016
-
connex.csc.uvic.ca connex.csc.uvic.caupl.pdf1
-
The higher the abstraction, the more detail is lost
ex. python
-
- Aug 2016
-
jeffknupp.com jeffknupp.com
-
A good article on unit testing in python.
-
- Jul 2016
-
stackoverflow.com stackoverflow.com
-
True.
a = np.array(1) # 0-d, but different from np.int64(1)
b = np.array([1]) # 1-d, same as a.reshape((1))
c = np.array([[1]]) # 2-d, same as a.reshape((1,1))
-
- Jun 2016
-
docs.scipy.org docs.scipy.org
-
Remember that a slicing tuple can always be constructed as obj and used in the x[obj] notation. Slice objects can be used in the construction in place of the [start:stop:step] notation. For example, x[1:10:5,::-1] can also be implemented as obj = (slice(1,10,5), slice(None,None,-1)); x[obj] . This can be useful for constructing generic code that works on arrays of arbitrary dimension.
-
- Apr 2016
-
blog.techrocket.com blog.techrocket.com
-
That’s probably the Dropbox server. Two million lines of code and counting, and it serves hundreds of millions of users.
I wonder what the biggest pain points are in maintaining a code base of this size in Python besides typing and performance, which Dropbox are already addressing via mypy and Pyston respectively.
-
I want Python to be more effective for large projects, without losing sight of its use for small projects and teaching. It’s quite a challenge; my current hope lies in PEP 484 and mypy, an approach to optional static typing (a.k.a. gradual typing). It’s super exciting. There are also other things happening in the community that make Python faster.
-
-
rhodesmill.org rhodesmill.org
-
github.com github.com
-
Transcrypt, a Python to JavaScript transpiler.
Tags
Annotators
URL
-
- Feb 2016
-
lib.chdorner.com lib.chdorner.com
-
The rule of thumb is to avoid using more than two expressions in a list comprehension. This could be two conditions, two loops, or one condition and one loop. As soon as it gets more complicated than that, you should use normal if and for statements and write a helper function
-
Dictionaries and sets have their own equivalents of list comprehen-sions.
It gets better an better!
d = { "foo": "bar", "baz": "qux" } r = {val: key for key, val in d.items()} #=> { "bar": "foo", "qux": "baz" }
-
Unlike map, list comprehensions let you easily filter items from the input list, removing corresponding outputs from the result.
This might be the greatest advantage of list comprehensions. Even in Ruby requires one to return a nil value from a map and then a call to compact, like: array.map(&:transform).compact.
-
Beware that indexing a list by a negative variable is one of the few situations in which you can get surprising results from slicing. For example, the expression so melist[-n:] will work fine when n is greater than one (e.g., somelist[-3:]). However, when n is zero, the expression so melist[-0:] will result in a copy of the original list.
Which is the same for somelist[:]. Not sure what the author is getting at. Maybe he meant to say that using variables as indexes when slicing can become confusing?
-
Slicing can be extended to any Python class that implements the__getitem__ and __setitem__ special methods
-
In a file, functions and classes should be separated by two blank lines.
I wonder what the reasoning for having two blank lines for separating functions and one blank line for methods is. Seems like an arbitrary distinction.
Tags
Annotators
URL
-
- Dec 2015
-
www.voidspace.org.uk www.voidspace.org.uk
-
The basic principle is that you patch where an object is looked up, which is not necessarily the same place as where it is defined. A couple of examples will help to clarify this.
This caught me out, as it did for a lot of other people apparently, see also this useful post about Python Mock gotchas: http://alexmarandon.com/articles/python_mock_gotchas/
Tags
Annotators
URL
-
- Nov 2015
-
pythonhosted.org pythonhosted.org
-
Given we put the system in a known state before the user (or external system) starts interacting with the system (in the When steps). Avoid talking about user interaction in givens. When we take key actions the user (or external system) performs. This is the interaction with your system which should (or perhaps should not) cause some state to change. Then we observe outcomes.
Tags
Annotators
URL
-
- Oct 2015
-
mock.readthedocs.org mock.readthedocs.org
-
The current version is None. Mock is stable and widely used.
Err.. whoops
Tags
Annotators
URL
-
- Jul 2015
-
www.venturesity.com www.venturesity.com
-
Up for a Challenge?
Do you have what it takes? Signup on www.venturesity.com and unlock opportunities.
-
-
www.talkpythontome.com www.talkpythontome.com
-
Podcat with Armin Ronanch, creator of the my personal favorite web microframework, Flask.
-
- May 2015
-
www.python.org www.python.org
Tags
Annotators
URL
-
- Mar 2015
-
www.paypal-engineering.com www.paypal-engineering.com
-
Python is in fact compiled to bytecode
-
A now-famous early usage of Python was in 1996: Google’s first successful web crawler.
It is interesting to know that this fact on Python!
-
- Nov 2014
-
learnxinyminutes.com learnxinyminutes.com
-
Python was created by Guido Van Rossum in the early 90s. It is now one of the most popular languages in existence. I fell in love with Python for its syntactic clarity. It’s basically executable pseudocode.
Helpful concise, Python syntax doc
-
-
www.pythonlearn.com www.pythonlearn.com
-
The goal of this site is to provide a set of materials in support of my Python for Informatics: Exploring Information book to allow you to learn Python on your own. This page serves as an outline of the materials to support the textbook.
http://www.pythonlearn.com/ | A great resource for starting programmers looking to build knowledge and gain skills. Open Source Course
-
- Feb 2014
-
pythonpracticeprojects.com pythonpracticeprojects.com
-
The hard part is teaching the consequences of each choice.
Once you get the syntax and basic language idioms out of the way this is the real problem that faces us no matter what language we pick.
-
- Dec 2013
-
learnpythonthehardway.org learnpythonthehardway.org
-
Read about how to use all of the things you installed.
pip
= A tool for installing and managing Python packagesnose
= A testing package for Pythonvirtualenv
= A Virtual Python Environment builder; helps you avoid updating libraries when you shouldn'tdistribute
= Easily download, build, install, upgrade, and uninstall Python packages
Tags
Annotators
URL
-
- Nov 2013
-
docs.python.org docs.python.org
-
A class instance has a namespace implemented as a dictionary which is the first place in which attribute references are searched. When an attribute is not found there, and the instance’s class has an attribute by that name, the search continues with the class attributes.
This search in namespaces -- first in the class instance and then in the class -- is documented here. Perhaps easier to understand by reading http://stackoverflow.com/a/15992667/7782
Tags
Annotators
URL
-
-
www.python-requests.org www.python-requests.org
-
Compared with the 1.0 release, there were relatively few backwards incompatible changes, but there are still a few issues to be aware of with this major release.
I got all panicky when installing internetarchive via pip caused a move from requests 1.1.0 to 2.0.x -- I had thought that jump was the BIG ONE that broke a lot of other modules. Maybe not.
Tags
Annotators
URL
-
- Oct 2013
-
jakevdp.github.io jakevdp.github.io
-
The ability to seamlessly insert IPython notebooks into posts was one of the biggest drivers of my switch to Pelican.
I want to study how Jake integrates IPython notebooks into his blogging. I'll be writing a lot in IPython notebook for my teaching.
-
-
www.pip-installer.org www.pip-installer.org
-
Three things are required to fully guarantee a repeatable installation using requirements files.
"Ensuring Repeatability"
-