79140746

Date: 2024-10-30 10:54:11
Score: 0.5
Natty:
Report link

You can treat indices as bins and values as weights for np.bincount.

values = np.array([0.0, 1.0, 2.0, 3.0, 4.0])
indices = np.array([0,1,0,2,2])

sums = np.bincount(indices, weights=values)
Reasons:
  • Low length (1):
  • Has code block (-0.5):
Posted by: tbhaxor