Created
March 19, 2020 16:37
-
-
Save nim4n136/7a102c02759106a920a367a5567137f0 to your computer and use it in GitHub Desktop.
cluster.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
def cluster_data(lst_array, max_range): | |
clustered = defaultdict(list) | |
n = 1 | |
for lst in lst_array: | |
clustered[n].append(lst) | |
n = n+1 | |
if n > max_range: | |
n = 1 | |
return clustered | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment