- Naming conventions of Python from PEP 8
- Operator precedence
- Boolean operations -
and
,or
,not
for short-circuit operators.
help
. For instance,help(len)
, orhelp(tuple.index)
for known functions or methods.- In IPython (e.g. Jupyter Notebook),
? len
also works.
While The Python Language Reference describes the exact syntax and semantics of the Python language, this library reference manual describes the standard library that is distributed with Python. It also describes some of the optional components that are commonly included in Python distributions.
venv
provides a convinient way to creat "lightweight 'virtual environments'". Read Virtual Environments and Packages for the official tutorial.
dir
returns all methods (attributes) of specified instance (object).type
returns the data type of the object in Python.import
is likesource
andlibrary
in R, sourcing packages or script files.len
returns the length of the object. (cf:length
in R)set
returns unique values in the object, and that allows mathematical set operations.list(set(a_list))
is a way to have unique values in the lista_list
. (cf:unique
in R;pandas.Series.unique
in pandas library)zip
returns a mapped iterable from multiple instances (objects).enumerate
returns an enumerate object. It is useful withitemgetter
inoperator
module when finding maximum value and its index in a list.
=
.a = b
means thata is b
isTrue
and they share the same memory, i.e. changing a will change b. (cf:a = b
ora <- b
in R copies b and assigns that to a, i.e. changing a won't change b. Read also Use "<-" or "=".)
- My Gist comparison.py demonstrates the difference between
==
andis
. Besides I mentionpd.DataFrame.equals
there for comparing DataFrames.
Unlike R, Python is usually not a functional programming language. Still, these following functionalities provide essential help or comparison.
-
lambda
are Python's way of creating anonymous functions. This is unlike R.You declare a lambda function with the word
lambda
followed by a list of arguments, followed by a colon and then a single expression and this is key. There's only one expression to be evaluated in a lambda. The expression value is returned on execution of the lambda. -
map
is kind of likesapply
in R. See defining functions in R and Python for an example.
-
A variety of matrix completion and imputation algorithms implemented in Python including MICE and k-NN.
-
NumPy is the fundamental package for scientific computing with Python.
-
pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
- See Comparison with R / R libraries for reference to equivalent functionality in R.
- How to deal with non-decodable bytes with importing data with
pandas
(written in Mandarin) - Check my asked questions about
pandas
on Stack Overflow.
-
Python dev workflow for humans
-
Generate requirements.txt file for any project based on imports
-
This regex implementation is backwards-compatible with the standard 're' module, but offers additional functionality.
-
- A scalable, VM-like solution
- Official getting started
- Python docker hub for getting Python environment in docker
- Personal notes of docker
-
- Build protocol for backend services (What is gRPC?)
- Official documents by languages
- Proto3 language guide
- gRPC/Python docker hub for building gRPC services in Python in docker environment
- gRPC GitHub
- Comparing gRPC with REST
- References in practice