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 networkx as nx | |
import matplotlib.pyplot as plt | |
G = nx.Graph() | |
G.add_edges_from( | |
[(7, 11), (7, 8), (5, 11), (3, 8), (3, 10), (11, 2), (11, 9), | |
(11, 10), (8, 9)]) | |
pos = nx.spring_layout(G, iterations=100) | |
for node, loc in pos.iteritems(): | |
print('{n}: {l}'.format(n=node, l=loc)) |
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 numpy as np | |
import timeit | |
def random_data(N): | |
# Generate some random data. | |
return np.random.uniform(0., 10., N) | |
# Data lists. | |
array1 = np.array([random_data(4) for _ in range(10000)]) # pump up the number of iterations in optfunc | |
array2 = np.array([random_data(3) for _ in range(100)]) |
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 numpy as np | |
import timeit | |
def random_data(N): | |
# Generate some random data. | |
return np.random.uniform(0., 10., N) | |
# Data lists. | |
array1 = np.array([random_data(4) for _ in range(1000)]) | |
array2 = np.array([random_data(3) for _ in range(2000)]) |
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 numpy as np | |
from scipy import ndimage | |
import matplotlib.pyplot as plt | |
#Data: | |
x = np.linspace(0, 2*np.pi,100) | |
f = np.sin(x) + 0.002*(np.random.rand(100)-.5) | |
#Normalization: | |
dx = x[1]-x[0] |
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
Invoked with : | |
--ncalls: 3 | |
--repeats: 6 | |
------------------------------------------------------------------------------- | |
Test name | head[ms] | base[ms] | ratio | | |
------------------------------------------------------------------------------- | |
groupby_first_float32 | 5.1910 | 6.4894 | 0.7999 | |
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
Invoked with : | |
--ncalls: 3 | |
--repeats: 6 | |
------------------------------------------------------------------------------- | |
Test name | head[ms] | base[ms] | ratio | | |
------------------------------------------------------------------------------- | |
mask_bools | 33.1504 | 46.0804 | 0.7194 | |
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
Invoked with : | |
--ncalls: 3 | |
--repeats: 3 | |
------------------------------------------------------------------------------- | |
Test name | head[ms] | base[ms] | ratio | | |
------------------------------------------------------------------------------- | |
frame_reindex_columns | 0.4276 | 0.5569 | 0.7678 | |
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 numpy as np | |
import pandas as pd | |
nan = np.nan | |
def array_equivalent(a1, a2): | |
try: | |
a1, a2 = np.asarray(a1), np.asarray(a2) | |
except (TypeError, ValueError): | |
return False | |
a1_mask = pd.isnull(a1) |
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 numpy as np | |
import pandas as pd | |
import timeit | |
def array_equivalent(a1, a2): | |
try: | |
a1, a2 = np.asarray(a1), np.asarray(a2) | |
except (TypeError, ValueError): | |
return False | |
a1_mask = pd.isnull(a1) |
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 numpy as np | |
import pandas as pd | |
import guppy | |
def array_equivalent(a1, a2): | |
h.setrelheap() | |
try: | |
a1, a2 = np.asarray(a1), np.asarray(a2) | |
except (TypeError, ValueError): | |
return False |
NewerOlder