# CrossCompute
borough_select = """
MANHATTAN
MANHATTAN
BRONX
BROOKLYN
QUEENS
STATEN ISLAND
"""
house_number = ''
street_name = ''
permit_status_select = """
ISSUED
ISSUED
RE-ISSUED
IN PROCESS
"""
limit = 50
target_folder = '/tmp'
house = None if house_number == '' else house_number.upper()
street = None if street_name == '' else street_name.upper()
if len(borough_select.strip().splitlines()) >= 1:
borough = borough_select.strip().splitlines()[0]
else :
borough = None
if len(permit_status_select.strip().splitlines()) >= 1:
permit = permit_status_select.strip().splitlines()[0]
else:
permit = None
MyAppToken = 'LqGukJbrfdrSncmmtR5tp3y4l'
import pandas as pd
from sodapy import Socrata
client = Socrata('data.cityofnewyork.us', MyAppToken)
params = {
'borough': borough,
'limit': limit,
'house__': house,
'street_name' : street,
'permit_status' : permit
}
results = client.get("83x8-shf7", **params)
#results_df = pd.DataFrame.from_records(results)
selected_t = pd.DataFrame.from_records(results)
selected_t['FillGreens'] = selected_t['community_board']
from os.path import join
selected_t['longitude'] = selected_t['gis_longitude']
selected_t['latitude'] = selected_t['gis_latitude']
target_path = join(target_folder, 'locations.csv')
selected_t.to_csv(target_path, index=False)
print('x_geotable_path = %s' % target_path)
target_path = join(target_folder, 'locations.csv')
selected_t.to_csv(target_path, index=False)
print('selected_location_building_table_path = %s' % target_path)