Python
def f(x):
return x + 1
map(f, [1, 2, 3]) # ⇒ [2, 3, 4] Learning Python from Ruby; Differences and Similarities - Stack Overflow
for n in [1, 2, 3]:
print n [[http://stackoverflow.com/questions/4769004/learning-python-from-ruby-differences-and-similarities|Learning Python from Ruby; Differences and Similarities - Stack Overflow]]
—-
python3 -m venv myvenv
$ source myvenv/bin/activate
(myvenv) $ curl wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python
(myvenv) $ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python python 3.x - Python3 Virtual Environment and PIP - Stack Overflow
import pandas as pd
df = pd.DataFrame({'x': [1, 1, 2, 2, 1, 1], 'y':[1, 2, 2, 2, 2, 1]})
print pd.factorize(pd.lib.fast_zip([df.x, df.y]))[0]
the output is:
[0 1 2 2 1 0] python - multi-column factorize in pandas - Stack Overflow
df.values.nbytes + df.index.nbytes + df.columns.nbytes python - Pandas: How to estimate how much memory a dataframe will need - Stack Overflow
%load_ext memory_profiler python - Measure (max) memory usage with IPython—like timeit but memit - Stack Overflow