Skip to content

Instantly share code, notes, and snippets.

View user3483203's full-sized avatar

Chris user3483203

  • Texas
View GitHub Profile
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
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>
@user3483203
user3483203 / pandas_column_slice.py
Created August 10, 2018 21:02
Pandas Column Slicing
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)])
#! /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
# 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_]