Progress Bars...
In [1]:
!pip install tqdm
In [4]:
from tqdm import tqdm
from time import sleep
for i in tqdm(range(1000)):
sleep(0.01)
In [1]:
%%time
for _ in range(1000):
sleep(0.01)# sleep for 0.01 seconds
In [2]:
import numpy as np
%timeit np.random.normal(size=100)
In [4]:
# %load some_code.py
import numpy as np
from scipy.stats import kendalltau
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="ticks")
rs = np.random.RandomState(11)
x = rs.gamma(2, size=1000)
y = -.5 * x + rs.normal(size=1000)
%prun sns.jointplot(x, y, kind="hex", stat_func=kendalltau, color="#4CB391")
plt.show()
In [1]:
%pdb
def f(x):
return 1. / x
y = f(0)
In [ ]:
%pdf off
In [ ]:
%debug
In [9]:
y
In [ ]:
!pip install cython
In [ ]:
%load_ext Cython
In [ ]:
%%cython
def myltiply_by_2(float x):
return 2.0 * x
In [ ]:
def mult(x):
return 2.0 * x
In [ ]:
%ptime [mult(x) for x in range(100000)]
In [ ]:
%ptime [myltiply_by_2(x) for x in range(100000)]