OpenData - DOB permit Issuance




Pay Notebook Creator: Rod Miky0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [21]:
# 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'
In [30]:
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
In [31]:
MyAppToken = 'LqGukJbrfdrSncmmtR5tp3y4l'
import pandas as pd
from sodapy import Socrata
client = Socrata('data.cityofnewyork.us', MyAppToken)
In [32]:
params = {
    'borough': borough,
    'limit': limit,
    'house__': house,
    'street_name' : street,
    'permit_status' : permit
}
In [35]:
results = client.get("83x8-shf7", **params)
In [36]:
#results_df = pd.DataFrame.from_records(results)
In [37]:
selected_t = pd.DataFrame.from_records(results)
selected_t['FillGreens'] = selected_t['community_board']
In [38]:
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)
x_geotable_path = /tmp/locations.csv
In [39]:
target_path = join(target_folder, 'locations.csv')
selected_t.to_csv(target_path, index=False)
print('selected_location_building_table_path = %s' % target_path)
selected_location_building_table_path = /tmp/locations.csv
In [ ]: