Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Create float intervals solution in 3rd party category for Create Intervals by V.Shkaberda
import numpy as np
def create_intervals(data):
# Clear the mess
c = np.array(sorted(data), dtype=np.float64) # int is not allowed on CheckIO:(
# Get the place
g = np.where(c - np.roll(c, 1)!=1)[0]
# Tuples in array embrace
return [(c[b], c[e]) for (b, e) in zip(g, np.append(g[1:], len(c))-1)]
Oct. 23, 2018
Comments: