Skip to content

Instantly share code, notes, and snippets.

@audhiaprilliant
Created July 13, 2021 02:19
Show Gist options
  • Select an option

  • Save audhiaprilliant/0176b7135db32b5d82c9e7533ed38313 to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/0176b7135db32b5d82c9e7533ed38313 to your computer and use it in GitHub Desktop.
def checkAdminArea(ID, data):
admin_code = str(ID)[:6]
# Check the admin area
status = False
prov, district, subdistrict = None, None, None
bin_status = binary_search(a = data['code'], x = admin_code)
if bin_status:
status = True
# Get the values
prov, district, subdistrict = df[df['code'] == admin_code].values.tolist()[0][1:]
return (status, prov, district, subdistrict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment