What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-11 15:21:23
plotly_chart
import streamlit as st import plotly.figure_factory as ff import numpy as np # Add histogram data x1 = np.random.randn(200) - 2 x2 = np.random.randn(200) x3 = np.random.randn(200) + 2 # Group data together hist_data = [x1, x2, x3] group_labels = ['Grou... Add solution -
Python 2021-11-09 16:10:10
How to colour a specific cell in pandas dataframe
import pandas as pd import numpy as np np.random.seed(24) df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))], axis=1) df.iloc[0, 2] = np.nan df.iloc[3, 3] = np.na... Add solution -
Other 2021-11-09 06:17:20
matplotlib animate
import matplotlib.pyplot as plt from matplotlib import cm import numpy as np from celluloid import Camera numpoints = 10 points = np.random.random((2, numpoints)) colors = cm.rainbow(np.linspace(0, 1, numpoints)) camera = Camera(plt.figure()) for _ in ra... Add solution -
Python 2021-11-07 10:34:09
python how to generate random number in a range
import random # generates completely random number x = random.random() # generates a random int x = random.randint() # generates a random int in a range x = random.randint(1, 100) # NOTE: RANGE DOESN'T WORK FOR random.random() Add solution -
Python 2021-11-06 09:26:13
python numpy find nearest value
import numpy as np def find_nearest(array, value): array = np.asarray(array) idx = (np.abs(array - value)).argmin() return array[idx] array = np.random.random(10) print(array) # [ 0.21069679 0.61290182 0.63425412 0.84635244 0.91599191 0.... Add solution
Best helpers
Ranking is empty