Currently reading articles under label: Python

Python Code Cookbook

See also:

Learning Python, the Language

Pandas

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

else:

......

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)

Related:

learning Django

py code cookbook/reuse

INSTALL PY3

win

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

Related:

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......

Jupyter

INSTALL

anaconda

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

It is not suitable for the ones wanna try very new things.

for windows

Download Python 3 from Anaconda and install.

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

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')

close(pFileWrite)

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