#NEWLINE# def city_neighborhood( data ) : #NEWLINE# #INDENT# "\n    A helper method that concatenates the city name with neighborhood name\n    This is used as an insurance policy to distinguish two cities that may \n    share the same neighborhood name\n    \n    Args:\n        data - a pandas DataFrame with city and neighborhood columns\n    \n    Returns:\n        a DataFrame with a new column 'city_neighborhood' that contains the\n        concatenated string data.city[i] + ' ' + data.neighborhood[i]\n    " #NEWLINE# data [ 'city_neighborhood' ] = '' #NEWLINE# for idx in data . index : #NEWLINE# #INDENT# c = data . city [ idx ] #NEWLINE# n = c . neighborhood [ idx ] #NEWLINE# data [ 'city_neighborhood' ] [ idx ] = ( '%s %s' % ( c , n ) ) #NEWLINE# #UNINDENT# return data