nodes: 0, module; 1, function_definition; 2, function_name:make_geohash_tables; 3, parameters; 4, block; 5, identifier:table; 6, identifier:listofprecisions; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# logic for accepting kwarg inputs; 12, for_statement; 13, comment:# getting header; 14, expression_statement; 15, comment:# getting columns; 16, expression_statement; 17, comment:# getting original table; 18, expression_statement; 19, if_statement; 20, expression_statement; 21, comment:# making total table to hold a list of dfs; 22, if_statement; 23, for_statement; 24, if_statement; 25, identifier:kwargs; 26, string; 27, assignment; 28, assignment; 29, pattern_list; 30, call; 31, block; 32, assignment; 33, assignment; 34, assignment; 35, not_operator; 36, block; 37, assignment; 38, boolean_operator; 39, block; 40, elif_clause; 41, identifier:row; 42, identifier:listofprecisions; 43, block; 44, comparison_operator:return_squares == True; 45, block; 46, else_clause; 47, string_content:sort_by - field to sort by for each group
  	return_squares - boolean arg if true returns a list of squares instead of writing out to table; 48, identifier:return_squares; 49, False; 50, identifier:sort_by; 51, string; 52, identifier:key; 53, identifier:value; 54, attribute; 55, argument_list; 56, if_statement; 57, if_statement; 58, identifier:header; 59, subscript; 60, identifier:columns; 61, subscript; 62, identifier:originaltable; 63, identifier:table; 64, comparison_operator:sort_by == 'COUNT'; 65, expression_statement; 66, identifier:listofprecisions; 67, call; 68, comparison_operator:return_squares == True; 69, comparison_operator:listofprecisions[-1] == 8; 70, expression_statement; 71, comparison_operator:return_squares == True; 72, block; 73, expression_statement; 74, expression_statement; 75, expression_statement; 76, expression_statement; 77, expression_statement; 78, expression_statement; 79, expression_statement; 80, comment:# iterating through each square here; 81, for_statement; 82, comment:# taking newsquares to dataframe; 83, expression_statement; 84, if_statement; 85, identifier:return_squares; 86, True; 87, return_statement; 88, block; 89, string_content:COUNT; 90, identifier:kwargs; 91, identifier:iteritems; 92, comparison_operator:key == 'sort_by'; 93, block; 94, comparison_operator:key == 'return_squares'; 95, block; 96, call; 97, integer:0; 98, identifier:header; 99, slice; 100, identifier:sort_by; 101, string; 102, assignment; 103, identifier:sorted; 104, argument_list; 105, identifier:return_squares; 106, True; 107, subscript; 108, integer:8; 109, assignment; 110, identifier:return_squares; 111, True; 112, expression_statement; 113, assignment; 114, assignment; 115, assignment; 116, assignment; 117, assignment; 118, assignment; 119, assignment; 120, identifier:row; 121, subscript; 122, comment:# getting points; 123, block; 124, assignment; 125, comparison_operator:return_squares == True; 126, block; 127, else_clause; 128, identifier:total_list; 129, print_statement; 130, identifier:key; 131, string; 132, expression_statement; 133, identifier:key; 134, string; 135, expression_statement; 136, identifier:df2list; 137, argument_list; 138, integer:10; 139, string_content:COUNT; 140, identifier:originaltable; 141, call; 142, identifier:listofprecisions; 143, keyword_argument; 144, identifier:listofprecisions; 145, unary_operator; 146, identifier:total_list; 147, list; 148, assignment; 149, identifier:precision; 150, call; 151, identifier:table; 152, identifier:originaltable; 153, subscript; 154, subscript; 155, identifier:table; 156, call; 157, identifier:table; 158, call; 159, identifier:table; 160, call; 161, identifier:newsquares; 162, list; 163, call; 164, slice; 165, expression_statement; 166, comment:# making new row; 167, expression_statement; 168, comment:# appending to newsquares; 169, expression_statement; 170, identifier:table; 171, call; 172, identifier:return_squares; 173, True; 174, expression_statement; 175, block; 176, string; 177, string_content:sort_by; 178, assignment; 179, string_content:return_squares; 180, assignment; 181, identifier:table; 182, attribute; 183, argument_list; 184, identifier:reverse; 185, True; 186, integer:1; 187, identifier:table; 188, identifier:total_list; 189, list; 190, identifier:int; 191, argument_list; 192, identifier:table; 193, string; 194, attribute; 195, slice; 196, attribute; 197, argument_list; 198, attribute; 199, argument_list; 200, attribute; 201, argument_list; 202, identifier:header; 203, identifier:df2list; 204, argument_list; 205, integer:1; 206, assignment; 207, assignment; 208, call; 209, identifier:list2df; 210, argument_list; 211, call; 212, expression_statement; 213, string_content:Wrote output squares tables to csv files.; 214, identifier:sort_by; 215, identifier:value; 216, identifier:return_squares; 217, identifier:value; 218, identifier:originaltable; 219, identifier:sort; 220, list; 221, keyword_argument; 222, identifier:row; 223, string_content:GEOHASH; 224, attribute; 225, identifier:str; 226, identifier:precision; 227, call; 228, identifier:sum; 229, identifier:table; 230, identifier:sort; 231, list; 232, keyword_argument; 233, identifier:table; 234, identifier:reset_index; 235, identifier:table; 236, identifier:points; 237, call; 238, identifier:newrow; 239, binary_operator:[row[0]] + points + row[1:]; 240, attribute; 241, argument_list; 242, identifier:newsquares; 243, attribute; 244, argument_list; 245, call; 246, identifier:sort_by; 247, identifier:ascending; 248, list; 249, identifier:table; 250, identifier:GEOHASH; 251, attribute; 252, argument_list; 253, identifier:sort_by; 254, identifier:ascending; 255, list; 256, identifier:get_points_geohash; 257, argument_list; 258, binary_operator:[row[0]] + points; 259, subscript; 260, identifier:newsquares; 261, identifier:append; 262, identifier:newrow; 263, identifier:total_list; 264, identifier:append; 265, identifier:table; 266, attribute; 267, argument_list; 268, integer:0; 269, subscript; 270, identifier:groupby; 271, list; 272, keyword_argument; 273, integer:0; 274, subscript; 275, list; 276, identifier:points; 277, identifier:row; 278, slice; 279, identifier:table; 280, identifier:to_csv; 281, binary_operator:'squares' + str(precision) + '.csv'; 282, keyword_argument; 283, identifier:table; 284, binary_operator:['GEOHASH','COUNT']+columns; 285, string; 286, identifier:sort; 287, True; 288, identifier:row; 289, integer:0; 290, subscript; 291, integer:1; 292, binary_operator:'squares' + str(precision); 293, string; 294, identifier:index; 295, False; 296, list; 297, identifier:columns; 298, string_content:GEOHASH; 299, identifier:row; 300, integer:0; 301, string; 302, call; 303, string_content:.csv; 304, string; 305, string; 306, string_content:squares; 307, identifier:str; 308, argument_list; 309, string_content:GEOHASH; 310, string_content:COUNT; 311, identifier:precision
code: def make_geohash_tables(table,listofprecisions,**kwargs):
  	'''
  	sort_by - field to sort by for each group
  	return_squares - boolean arg if true returns a list of squares instead of writing out to table
  	'''
  	return_squares = False
  	sort_by = 'COUNT'
  	# logic for accepting kwarg inputs
  	for key,value in kwargs.iteritems():
  		if key == 'sort_by':
  			sort_by = value
  		if key == 'return_squares':
  			return_squares = value
  
  	# getting header
  	header = df2list(table)[0]
  
  	# getting columns
  	columns = header[10:]
  
  	# getting original table
  	originaltable = table
  	if not sort_by == 'COUNT':
  		originaltable = originaltable.sort([sort_by],ascending=[0])
  
  
  
  
  	listofprecisions = sorted(listofprecisions,reverse=True)
  	# making total table to hold a list of dfs
  	if return_squares == True and listofprecisions[-1] == 8:
  		total_list = [table]
  	elif return_squares == True:
  		total_list = []
  
  	for row in listofprecisions:
  		precision = int(row)
  		table = originaltable
  		table['GEOHASH'] = table.GEOHASH.str[:precision]
  		table = table[['GEOHASH','COUNT']+columns].groupby(['GEOHASH'],sort=True).sum()
  		table = table.sort([sort_by],ascending=[0])
  		table = table.reset_index()
  
  		newsquares = [header]
  		# iterating through each square here 
  		for row in df2list(table)[1:]:
  			# getting points
  			points = get_points_geohash(row[0])
  			
  			# making new row
  			newrow = [row[0]] + points + row[1:]
  			
  			# appending to newsquares 
  			newsquares.append(newrow)
  
  		# taking newsquares to dataframe
  		table = list2df(newsquares)
  
  		if return_squares == True:
  			total_list.append(table)
  		else:
  			table.to_csv('squares' + str(precision) + '.csv',index=False)
  
  	if return_squares == True:
  		return total_list
  	else:
  		print 'Wrote output squares tables to csv files.'