From 5d8641732f81c444a92d470e6e34abe1ef51a0da Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Tue, 18 Oct 2016 19:30:09 +0000 Subject: [PATCH] change string formatting --- src/py/crankshaft/crankshaft/clustering/kmeans.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/py/crankshaft/crankshaft/clustering/kmeans.py b/src/py/crankshaft/crankshaft/clustering/kmeans.py index 84f83f7..e44b742 100644 --- a/src/py/crankshaft/crankshaft/clustering/kmeans.py +++ b/src/py/crankshaft/crankshaft/clustering/kmeans.py @@ -7,13 +7,11 @@ def kmeans(query, no_clusters, no_init=20): """ """ - full_query = ''' - SELECT array_agg(cartodb_id ORDER BY cartodb_id) as ids, - array_agg(ST_X(the_geom) ORDER BY cartodb_id) xs, - array_agg(ST_Y(the_geom) ORDER BY cartodb_id) ys - FROM ({query}) As a - WHERE the_geom IS NOT NULL - '''.format(query=query) + full_query = ("SELECT array_agg(cartodb_id ORDER BY cartodb_id) as ids," + "array_agg(ST_X(the_geom) ORDER BY cartodb_id) xs," + "array_agg(ST_Y(the_geom) ORDER BY cartodb_id) ys " + "FROM ({query}) As a " + "WHERE the_geom IS NOT NULL").format(query=query) try: data = plpy.execute(full_query) except plpy.SPIError, err: