kSEeG




Pay Notebook Creator: Jazmyn Fuller0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0

Search Food Vendor Status

{ name : Enter the name of desired Food Vendor}

In [2]:
#CrossCompute
name = ''
target_folder = '/tmp'
#source_table_path = 'Fvt_Lat_Long.csv'
In [3]:
source_table_path = 'Fvt_Lat_Long.csv'
In [4]:
import pandas as pd
url = 'https://www.nycgovparks.org/bigapps/DPR_Eateries_001.json'
fvt = pd.read_json(url, convert_dates=['state_date', 'end_date'])
In [5]:
selected_fvt = fvt[fvt['name'].str.contains(name, case=False)]
In [6]:
length = len(selected_fvt)
if(length == 0):
    print("There are no matching Food Vendors with this name.")
elif(length == 1):
    print("There is %s" %length + " matching Food Vendor with this name.")
elif(length>1):
    print("There are %s" %length + " matching Food Vendors with this name")
There are 242 matching Food Vendors with this name
In [7]:
print("Vendors_with_matching_name = %s" %length)
Vendors_with_matching_name = 242
In [8]:
from datetime import datetime
now = datetime.now()
filtered_fvt = selected_fvt[now > selected_fvt['end_date']]
exp_len = len(filtered_fvt)
print("There are %s" %exp_len + " expired Food Vendor Permits.")
There are 195 expired Food Vendor Permits.
In [9]:
allVendors = len(selected_fvt)
valid = allVendors-exp_len
valid_fvt = selected_fvt[now < selected_fvt['end_date']]
print("There are %s" %valid + " valid Food Vendor Permits.")
There are 47 valid Food Vendor Permits.
In [10]:
print("Vendors_with_valid_licenses = %s" %valid)
Vendors_with_valid_licenses = 47
In [11]:
target_path = target_folder + '/table1.csv'
valid_fvt.to_csv(target_path, index=False)
print('Valid_Vendor_table_path = %s' % target_path)
Valid_Vendor_table_path = /tmp/table.csv
In [12]:
print("Vendors_with_expired_license = %s" % exp_len)
Vendors_with_expired_license = 195
In [13]:
target_path = target_folder + '/table.csv'
filtered_fvt.to_csv(target_path, index=False)
print('Expired_Vendor_table_path = %s' % target_path)
Expired_Vendor_table_path = /tmp/table.csv
In [14]:
from os.path import join
from shutil import copy
target_path = join(target_folder, 'Fvt_Lat_Long.csv')
copy(source_table_path, target_path)
print('example_satellite_geotable_path = ' + target_path)
example_satellite_geotable_path = /tmp/Fvt_Lat_Long.csv

Vendor Status

{Vendors_with_matching_name : Total number of Food Vendors with this name: } {Vendors_with_expired_license : Food Vendors with this name and expired licenses: }

Landmark Math

{example_satellite_geotable : Food Truck/Cart Locations }