In [3]:
from random import expovariate, randint
import matplotlib.pyplot as plt
import seaborn as sbn
import numpy as np
from scipy.stats import expon, poisson

%matplotlib notebook

In [15]:
randint(-1, 1)


Out[15]:
-1

In [2]:
times = np.zeros((1000,1000))

for i in range(1000):
    for j in range(1000):
        times[i, j] = expovariate(10)

In [23]:
sbn.distplot(times[0], fit=expon, kde=False)


Out[23]:
<matplotlib.axes._subplots.AxesSubplot at 0x118011748>

In [24]:
cumtimes = times.cumsum(axis=1)

counts = []

for i in range(1000):
    counts.append(cumtimes[i][cumtimes[i] <= 1.0].size)

In [26]:
fig, ax = plt.subplots()
sbn.distplot(counts, bins=21, ax=ax, kde=False, norm_hist=True)
ax.plot(poisson(10).pmf(range(20)))


Out[26]:
[<matplotlib.lines.Line2D at 0x1195aa780>]

Input parameters generator

rate ... average number of events per second

burn in ... number of total points to ramp up to

n_events ... number of events to produce once burnt in

bounds ... bounding box for events

dist ... distribution to draw from

Input parameters distribution

bounds ... bounding box for events


In [17]:
a = {}

In [18]:
type(a)


Out[18]:
dict

In [19]:
from uuid import uuid4

In [34]:
a = 5


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-34-1df827eac7dd> in <module>()
----> 1 a[UUID('748f58b7-9199-4533-a68f-bacd0ffe4685')] = 5

NameError: name 'UUID' is not defined

In [23]:
a


Out[23]:
{UUID('748f58b7-9199-4533-a68f-bacd0ffe4685'): 3,
 UUID('ae453cd8-d75a-4ea9-b81b-0fec4f7badd7'): 2}

In [24]:
from random import sample

In [33]:
sample(a.keys(), 1)


Out[33]:
[UUID('748f58b7-9199-4533-a68f-bacd0ffe4685')]

In [35]:
b = {2: 'hello',
     3: 'world'}

In [36]:
b[2] = 'susi'

In [38]:
b.pop(2)


Out[38]:
'susi'

In [39]:
b


Out[39]:
{3: 'world'}

In [40]:
def f():
    pass

In [42]:
f()


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-42-cb1021f3ea68> in <module>()
----> 1 f('')

TypeError: f() takes 0 positional arguments but 1 was given

In [ ]: