Skip to content

Instantly share code, notes, and snippets.

@lobrien
Last active November 14, 2022 18:14
Show Gist options
  • Save lobrien/e1283e86fef5a280d52e390c176efedd to your computer and use it in GitHub Desktop.
Save lobrien/e1283e86fef5a280d52e390c176efedd to your computer and use it in GitHub Desktop.
Avg & std dev for Wordle
import numpy as np
rs = np.array([ [1,1], [2, 11], [3, 77], [4, 111], [5, 74], [6, 20], [7.25, 6]])
vs = rs.take(indices = 0, axis=1)
ns = rs.take(indices = 1, axis=1)
mean = np.average(vs, weights = ns)
sd = np.sqrt(np.average((vs - mean)**2, weights=ns))
(mean, sd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment