What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-28 01:00:27
how to periodically update dash
import time from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor import dash import dash_html_components as html import dash_core_components as dcc import plotly.graph_objs as go import numpy as np # number of seconds between re-calcul... Add solution -
Python 2022-02-02 10:30:11
make correlated array with cholesky decomposition python
import numpy as np #desired expected rho (of the distribution of the corr matrix) rho = 0.5 # desired correlation matrix cor_matrix = np.ones((5,5))* rho np.fill_diagonal(cor_matrix,1) # 1s in diagonal print(cor_matrix) # this is artificial case but it... Add solution -
Python 2021-10-25 14:23:13
convert array to dataframe python
np.random.seed(123) e = np.random.normal(size=10) dataframe=pd.DataFrame(e, columns=['a']) print (dataframe) a 0 -1.085631 1 0.997345 2 0.282978 3 -1.506295 4 -0.578600 5 1.651437 6 -2.426679 7 -0.428913 8 1.265936 9 -0.866740 e_datafram... Add solution -
Python 2021-10-20 13:36:09
convert dataframe to numpy array
np.random.seed(123) e = np.random.normal(size=10) dataframe=pd.DataFrame(e, columns=['a']) print (dataframe) a 0 -1.085631 1 0.997345 2 0.282978 3 -1.506295 4 -0.578600 5 1.651437 6 -2.426679 7 -0.428913 8 1.265936 9 -0.866740 e_datafram... Add solution -
Python 2021-10-16 22:08:08
matplotlib point labels
import matplotlib.pyplot as plt import numpy as np plt.clf() # using some dummy data for this example xs = np.arange(0,10,1) ys = np.random.normal(loc=2.0, scale=0.8, size=10) plt.plot(xs,ys) # text is left-aligned plt.text(2,4,'This text starts at po... Add solution -
Python 2021-09-25 13:01:03
animate time series python
import numpy as np import matplotlib.pyplot as plt from matplotlib import animation dt = 0.01 tfinal = 1 x0 = 0 sqrtdt = np.sqrt(dt) n = int(tfinal/dt) xtraj = np.zeros(n+1, float) trange = np.linspace(start=0,stop=tfinal ,num=n+1) xtraj[0] = x0 for i ... Add solution -
Python 2021-09-13 23:07:01
converting numpy array to dataframe
np.random.seed(123) e = np.random.normal(size=10) dataframe=pd.DataFrame(e, columns=['a']) print (dataframe) a 0 -1.085631 1 0.997345 2 0.282978 3 -1.506295 4 -0.578600 5 1.651437 6 -2.426679 7 -0.428913 8 1.265936 9 -0.866740 e_datafram... Add solution
Best helpers
Ranking is empty