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
Second Worker 1 Worker 2 Done | |
0 C . | |
1 C . | |
2 C . | |
3 A F C | |
4 B F CA | |
5 B F CA | |
6 D F CAB | |
7 D F CAB | |
8 D F CAB |
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 re | |
import numpy as np | |
test_data = """position=< 9, 1> velocity=< 0, 2> | |
position=< 7, 0> velocity=<-1, 0> | |
position=< 3, -2> velocity=<-1, 1> | |
position=< 6, 10> velocity=<-2, -1> | |
position=< 2, -4> velocity=< 2, 2> | |
position=<-6, 10> velocity=< 2, -2> |
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 pandas as pd | |
import numpy as np | |
def rand_idx(l): | |
a = np.random.randint(0, l//2) | |
b = np.random.randint(l//2, l) | |
return [a,b] | |
def piRSquared1(df, idx): | |
tups = sorted([(i, j) for j, args in enumerate(idx) for i in range(*args)]) |
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
#! /usr/bin/env python3 | |
""" Find all "words" of lowercase chars in a string | |
Speed tests, using the timeit module, of various approaches | |
See https://stackoverflow.com/q/51710087 | |
Written by Ajax1234, PM 2Ring, Kevin, and user3483203 | |
2018.08.07 |
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
# Functions | |
def set_lookup(strings_): | |
return [''.join([i if i in lwr else ' ' for i in s]).split() for s in strings_] | |
def regular_expressions(strings_): | |
return [re.findall(r'[a-z]+', s) for s in strings_] | |
def lower_check(strings_): | |
return ["".join(c if c.islower() else " " for c in s).split() for s in strings_] |