Currently reading articles under label: Python

Python Code Cookbook

See also:

Learning Python, the Language


Get column_nr in pandas/numpy.

if isinstance(X, pd.DataFrame):

X_is_df = True

row_nr = X.shape[0]

column_nr = X.shape[1]

if isinstance(X.columns, pd.core.index.MultiIndex):

df_columns_is_multi_index = True



Learning Falcon

A great 5-video tutorial: 35minutes on YouTube (6 tomatoes / 2.5 hours for non-stop studing by coding).

Author's Github (py2), My Github (py3).

Differences in my Github code:

py3, not py2

using on_put() to test validity of input json from client

using on_delete() to test params (just to test......

Python the Language (in case of)


learning Django

py code cookbook/reuse



Install py2 first! Install py3 later.

Download and install py3 from the official website.

During installation, make sure to "add to system PATH".

If it is only in user's "Path", we need to also add to sys......

Learning Django MVC Framework


Learning Python

Ref: This is combined learning notes of:

basic level sentdex's youtube tutorial, the corresponding video+text one is here.

middle level another tutorial: Django Tutorials for Beginners

book "O'Reilly 2014 - Test-Driven Development with Python (django 1.7)&qu......




This is suggested for very new users to use a stable environment.

It is NOT suitable for normal users / programmers / engineers.

for windows

Download Python 3 from Anaconda and install.

From Windows "Start" menu, run "Jupyter" directly. (at least since v5.3.1......

Cross-Read & -Write R, Py, Matlab, Binary Files

W/R .bin in R

tData = as.integer(2^(1:18))

# make sure what you are writing is the same format (e.g. integer) as reading.

pFileWrite = file('test_data/test.bin', 'wb')

writeBin(tData, pFileWrite, size=4, endian='little')


pFileRead = file('test_data/tes......