#!/usr/bin/env python | |
import json | |
import random | |
filename = "test.json" | |
x = [{"ID": i, | |
"xxx": "".join(["f"] * random.randint(1, 20)), | |
"yyy": "".join(["f"] * random.randint(1, 20))} | |
for i in range(20)] |
>>> p4 = pd.Panel4D({i: pd.Panel({j: pd.DataFrame(range(10)) for j in range(10)}) for i in range(10)}) | |
>>> p4.iloc[:,:,0] | |
<class 'pandas.core.panel.Panel'> | |
Dimensions: 10 (items) x 10 (major_axis) x 1 (minor_axis) | |
Items axis: 0 to 9 | |
Major_axis axis: 0 to 9 | |
Minor_axis axis: 0 to 0 | |
>>> p4.iloc[slice(None), slice(None), slice(0)] | |
<class 'pandas.core.panelnd.Panel4D'> | |
Dimensions: 10 (labels) x 10 (items) x 0 (major_axis) x 1 (minor_axis) |
every_nth = [2, 3] | |
index = pd.Series(range(len(df.index))) # or just df.index if it's already the 0-indexed indices | |
mask = reduce(np.logical_or, [index % i == 0 for i in every_nth]) | |
df[mask.astype(bool).values] |
# Install tmux on Centos release 6.5 | |
# install deps | |
yum install gcc kernel-devel make ncurses-devel | |
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL | |
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
tar -xvzf libevent-2.0.21-stable.tar.gz | |
cd libevent-2.0.21-stable | |
./configure --prefix=$HOME && |
### Keybase proof | |
I hereby claim: | |
* I am mdengler on github. | |
* I am mdengler (https://keybase.io/mdengler) on keybase. | |
* I have a public key whose fingerprint is 565C 8F33 ABF7 2DAA 33DE B9CB 81B4 44DD 75C7 D2F8 | |
To claim this, I am signing this object: |
Wilson’s algorithm uses loop-erased random walks to generate a uniform spanning tree — an unbiased sample of all possible spanning trees. Most other maze generation algorithms, such as Prim’s, random traversal and randomized depth-first traversal, do not have this beautiful property.
The algorithm initializes the maze with eight arbitrary starting cells. Then, a new cell is added to the maze, initiating a random walk (shown in magenta). The random walk continues until it reconnects with the existing maze (shown in white). However, if the random walk intersects itself, the resulting loop is erased before the random walk continues.
The global structure of the maze can be more easily seen by flooding it with color.
To play with this yourself, [instructions from Uehreka on http://news.yco
#!/usr/bin/python | |
# to use: | |
# 1) git clone [email protected]:jszakmeister/nose.git nose-711 | |
# 2) cd nose-711 | |
# 3) python setup.py build | |
# 4) cd build/lib | |
# 5) put this file there as test.py | |
# 6) PYTHONPATH=$PWD python -m nose ./test.py | |
# # observe the error: |