Skip to content

Instantly share code, notes, and snippets.

@ei-grad
Created February 5, 2018 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ei-grad/1355223cd8a3c6ba16deb454ddef50b4 to your computer and use it in GitHub Desktop.
Save ei-grad/1355223cd8a3c6ba16deb454ddef50b4 to your computer and use it in GitHub Desktop.
from sklearn.datasets import make_blobs
import numpy as np
coords, counties = make_blobs(1000, centers=20)
values = np.random.randint(0, 100, [20])
with open("input.csv", "w") as f:
f.write('Town,X,Y,County,Value\n')
for town, ((lon, lat), county) in enumerate(zip(coords, counties), 1):
f.write('Town%d,%.2f,%.2f,County%d,%d\n' % (town, lat, lon, county, values[county]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment