Skip to content

Instantly share code, notes, and snippets.

@wcbeard
wcbeard / jinjatemplate.py
Created February 20, 2014 05:29 — forked from rduplain/app.py
Flask snippets
class CustomFlask(Flask):
"https://gist.github.com/lost-theory/3925738"
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='%%',
block_end_string='%%',
variable_start_string='<%',
variable_end_string='%>',
comment_start_string='<#',
comment_end_string='#>',
# Pandas Quickstart #
## First off ##
Pandas has Series (list of values with index) and DataFrames (collection of Series).
- Each Series in a DataFrame is associated with a column name
- Each Series within a DataFrame must have the same length
## View ##
See first *n* rows: `.head(n)` (`n=5` by default):
"""
Benchmark script to bench scikit-learn's RandomForestClassifier
vs. R's randomForest.
It uses rpy2 to call R from python. Timings for randomForest are
pessimistic due to a constant overhead by wrapping numpy matrices
in R data_frames. The effect of the overhead can be reduced
by increasing the number of trees.
Note: make sure the LD_LIBRARY_PATH is set for rpy2::