View gist:2659700
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> m = [[]] * 10 | |
>>> m | |
[[], [], [], [], [], [], [], [], [], []] | |
>>> #everything seems to be OK | |
... | |
>>> m[0].append(10) | |
>>> m | |
[[10], [10], [10], [10], [10], [10], [10], [10], [10], [10]] | |
>>> #shit! | |
... |
View tictoc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
class TicToc: | |
""" A simple stopwatch object""" | |
def __init__(self, name=None, start=True): | |
if name is None: | |
name = 'Running time' | |
self.name = name | |
self.dt = 0.0 |
View triple_apply_problem.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View another_triple_apply_pecularity.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View holidays_in_tishrei.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View israeli_gender_payment_gap.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View monty_hall.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View asciihist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import numpy as np | |
def asciihist(it, bins=10, minmax=None, str_tag='', | |
scale_output=30, generate_only=False, print_function=print): | |
"""Create an ASCII histogram from an interable of numbers. | |
Author: Boris Gorelik boris@gorelik.net. based on http://econpy.googlecode.com/svn/trunk/pytrix/pytrix.py | |
License: MIT | |
""" | |
ret = [] |
View observation_adjustment.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
np.random.seed(123456) | |
N = 100 | |
aim = 0 | |
scale = 0.5 | |
adjusted = [] | |
for i in range(N): | |
curr = np.random.randn() * scale + aim | |
adjusted.append(curr) | |
aim = -curr | |
non_adjusted = np.random.randn(N)*scale |
View emphasizing in graphs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer