In [1]:
%%javascript

document.title = '#NotebookNYC: New York City Restaurant Inspection Results';
$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1.0">');

DOHMH New York City Restaurant Inspection Results

Dataset

Library

  • sodapy (Python bindings for the Socrata Open Data API) | github
In [2]:
import pandas as pd
from sodapy import Socrata
import matplotlib.pyplot as plt
In [3]:
import logging
logger = logging.getLogger()
logger.setLevel(logging.CRITICAL)
In [4]:
client = Socrata('data.cityofnewyork.us', None)

Data

id = '9w7m-hzhe'

In [5]:
id = '9w7m-hzhe'

Meta data

In [6]:
client.get_metadata(id)
Out[6]:
{'attribution': 'Department of Health and Mental Hygiene (DOHMH)',
 'averageRating': 0,
 'category': 'Health',
 'columns': [{'cachedContents': {'cardinality': '26318',
    'largest': '50064283',
    'not_null': '418685',
    'null': '0',
    'smallest': '30075445',
    'top': [{'count': '95', 'item': '50001880'},
     {'count': '94', 'item': '40965177'},
     {'count': '94', 'item': '41683816'},
     {'count': '91', 'item': '50033122'},
     {'count': '90', 'item': '41459659'},
     {'count': '87', 'item': '41717640'},
     {'count': '86', 'item': '50003580'},
     {'count': '84', 'item': '41289382'},
     {'count': '83', 'item': '40645073'},
     {'count': '81', 'item': '41528486'},
     {'count': '81', 'item': '50010805'},
     {'count': '80', 'item': '41510846'},
     {'count': '77', 'item': '50002875'},
     {'count': '77', 'item': '40861669'},
     {'count': '77', 'item': '40392685'},
     {'count': '76', 'item': '41226130'},
     {'count': '76', 'item': '41203533'},
     {'count': '76', 'item': '41164793'},
     {'count': '76', 'item': '41630632'},
     {'count': '75', 'item': '41083469'}]},
   'dataTypeName': 'text',
   'description': 'This is an unique identifier for the entity (restaurant)',
   'fieldName': 'camis',
   'format': {'align': 'left'},
   'id': 212407180,
   'name': 'CAMIS',
   'position': 1,
   'renderTypeName': 'text',
   'tableColumnId': 29669780,
   'width': 160},
  {'cachedContents': {'cardinality': '20819',
    'largest': "ZZ'S PIZZA & GRILL",
    'not_null': '418425',
    'null': '260',
    'smallest': '1,001 NIGHTS',
    'top': [{'count': '4470', 'item': "DUNKIN' DONUTS"},
     {'count': '4134', 'item': 'SUBWAY'},
     {'count': '2882', 'item': "MCDONALD'S"},
     {'count': '2258', 'item': 'STARBUCKS'},
     {'count': '1511', 'item': "DUNKIN' DONUTS, BASKIN ROBBINS"},
     {'count': '1463', 'item': "DOMINO'S"},
     {'count': '1279', 'item': 'CROWN FRIED CHICKEN'},
     {'count': '1140', 'item': 'KENNEDY FRIED CHICKEN'},
     {'count': '1140', 'item': 'BURGER KING'},
     {'count': '1025', 'item': 'POPEYES LOUISIANA KITCHEN'},
     {'count': '996', 'item': 'CHIPOTLE MEXICAN GRILL'},
     {'count': '936', 'item': 'GOLDEN KRUST CARIBBEAN BAKERY & GRILL'},
     {'count': '720', 'item': "PAPA JOHN'S"},
     {'count': '546', 'item': "WENDY'S"},
     {'count': '484', 'item': 'KFC'},
     {'count': '454', 'item': 'CARVEL ICE CREAM'},
     {'count': '438', 'item': 'AU BON PAIN'},
     {'count': '423', 'item': 'LITTLE CAESARS'},
     {'count': '408', 'item': 'CHECKERS'},
     {'count': '394', 'item': 'LE PAIN QUOTIDIEN'}]},
   'dataTypeName': 'text',
   'description': 'This field represents the name (doing business as) of the entity (restaurant)',
   'fieldName': 'dba',
   'format': {'align': 'left'},
   'id': 212407181,
   'name': 'DBA',
   'position': 2,
   'renderTypeName': 'text',
   'tableColumnId': 29669781,
   'width': 136},
  {'cachedContents': {'cardinality': '6',
    'largest': 'STATEN ISLAND',
    'not_null': '418685',
    'null': '0',
    'smallest': 'BRONX',
    'top': [{'count': '167235', 'item': 'MANHATTAN'},
     {'count': '103424', 'item': 'BROOKLYN'},
     {'count': '96784', 'item': 'QUEENS'},
     {'count': '36638', 'item': 'BRONX'},
     {'count': '14602', 'item': 'STATEN ISLAND'},
     {'count': '2', 'item': 'Missing'}]},
   'dataTypeName': 'text',
   'description': "Borough in which the entity (restaurant) is located. NOTE: There may be discrepancies between zip code and listed boro due to differences in an establishment's mailing address and physical location",
   'fieldName': 'boro',
   'format': {'align': 'left'},
   'id': 212407182,
   'name': 'BORO',
   'position': 3,
   'renderTypeName': 'text',
   'tableColumnId': 29669782,
   'width': 148},
  {'cachedContents': {'cardinality': '7250',
    'largest': 'W105',
    'not_null': '418592',
    'null': '93',
    'smallest': '0',
    'top': [{'count': '2559', 'item': '0'},
     {'count': '2282', 'item': '1'},
     {'count': '1523', 'item': '2'},
     {'count': '1303', 'item': '200'},
     {'count': '1062', 'item': '15'},
     {'count': '1045', 'item': '25'},
     {'count': '1025', 'item': '11'},
     {'count': '974', 'item': '9'},
     {'count': '958', 'item': '10'},
     {'count': '893', 'item': '120'},
     {'count': '891', 'item': '75'},
     {'count': '845', 'item': '7'},
     {'count': '831', 'item': '100'},
     {'count': '813', 'item': '85'},
     {'count': '813', 'item': '55'},
     {'count': '804', 'item': '12'},
     {'count': '799', 'item': '110'},
     {'count': '799', 'item': '111'},
     {'count': '797', 'item': '150'},
     {'count': '795', 'item': '6'}]},
   'dataTypeName': 'text',
   'description': 'This field represents the building number for the entity (restaurant)',
   'fieldName': 'building',
   'format': {'align': 'left'},
   'id': 212407183,
   'name': 'BUILDING',
   'position': 4,
   'renderTypeName': 'text',
   'tableColumnId': 29669783,
   'width': 196},
  {'cachedContents': {'cardinality': '3314',
    'largest': 'ZEREGA AVENUE',
    'not_null': '418685',
    'null': '0',
    'smallest': '08 CROSSISLAND PW',
    'top': [{'count': '15599', 'item': 'BROADWAY'},
     {'count': '6480', 'item': '3 AVENUE'},
     {'count': '4585', 'item': '5 AVENUE'},
     {'count': '4473', 'item': '2 AVENUE'},
     {'count': '4159', 'item': '8 AVENUE'},
     {'count': '3601', 'item': 'ROOSEVELT AVENUE'},
     {'count': '3544', 'item': '7 AVENUE'},
     {'count': '3414', 'item': 'LEXINGTON AVENUE'},
     {'count': '3332', 'item': '1 AVENUE'},
     {'count': '3322', 'item': 'AMSTERDAM AVENUE'},
     {'count': '3294', 'item': 'NORTHERN BOULEVARD'},
     {'count': '3003', 'item': 'JAMAICA AVENUE'},
     {'count': '3001', 'item': '9 AVENUE'},
     {'count': '2863', 'item': '3RD AVE'},
     {'count': '2662', 'item': 'QUEENS BOULEVARD'},
     {'count': '2478', 'item': '2ND AVE'},
     {'count': '2211', 'item': 'ROOSEVELT AVE'},
     {'count': '2195', 'item': '8TH AVE'},
     {'count': '2194', 'item': 'FULTON STREET'},
     {'count': '2173', 'item': '5TH AVE'}]},
   'dataTypeName': 'text',
   'description': 'This field represents the street name at which the entity (restaurant) is located.',
   'fieldName': 'street',
   'format': {'align': 'left'},
   'id': 212407229,
   'name': 'STREET',
   'position': 5,
   'renderTypeName': 'text',
   'tableColumnId': 29669784,
   'width': 172},
  {'cachedContents': {'cardinality': '233',
    'largest': 'N/A',
    'not_null': '418685',
    'null': '0',
    'smallest': '10001',
    'top': [{'count': '11713', 'item': '10003'},
     {'count': '10511', 'item': '10019'},
     {'count': '9805', 'item': '10036'},
     {'count': '9035', 'item': '10013'},
     {'count': '7972', 'item': '10002'},
     {'count': '7531', 'item': '10011'},
     {'count': '7451', 'item': '10001'},
     {'count': '7448', 'item': '10022'},
     {'count': '7431', 'item': '10016'},
     {'count': '6852', 'item': '11372'},
     {'count': '6727', 'item': '10014'},
     {'count': '6578', 'item': '11354'},
     {'count': '6539', 'item': '11211'},
     {'count': '6515', 'item': '10012'},
     {'count': '6264', 'item': '11220'},
     {'count': '5729', 'item': '11201'},
     {'count': '5605', 'item': '10017'},
     {'count': '5587', 'item': '11215'},
     {'count': '5231', 'item': '10018'},
     {'count': '5085', 'item': '10009'}]},
   'dataTypeName': 'text',
   'description': 'Zip code as per the address of the entity (restaurant)',
   'fieldName': 'zipcode',
   'format': {'align': 'left'},
   'id': 212407248,
   'name': 'ZIPCODE',
   'position': 6,
   'renderTypeName': 'text',
   'tableColumnId': 29669785,
   'width': 184},
  {'cachedContents': {'cardinality': '25046',
    'largest': '9852641540',
    'not_null': '418680',
    'null': '5',
    'smallest': '__________',
    'top': [{'count': '241', 'item': '7186566210'},
     {'count': '224', 'item': '7185958100'},
     {'count': '146', 'item': '2125867610'},
     {'count': '144', 'item': '9176186310'},
     {'count': '132', 'item': '7182153308'},
     {'count': '124', 'item': '2125867000'},
     {'count': '122', 'item': '2127800577'},
     {'count': '114', 'item': '2123661414'},
     {'count': '110', 'item': '9172843260'},
     {'count': '103', 'item': '__________'},
     {'count': '102', 'item': '2124656273'},
     {'count': '97', 'item': '2122441111'},
     {'count': '95', 'item': '7182810218'},
     {'count': '94', 'item': '7184245693'},
     {'count': '94', 'item': '7186510788'},
     {'count': '94', 'item': '3479866651'},
     {'count': '93', 'item': '7183537104'},
     {'count': '91', 'item': '7188860800'},
     {'count': '90', 'item': '9175672882'},
     {'count': '90', 'item': '2129829782'}]},
   'dataTypeName': 'text',
   'description': 'Phone Number',
   'fieldName': 'phone',
   'format': {'align': 'left'},
   'id': 212407249,
   'name': 'PHONE',
   'position': 7,
   'renderTypeName': 'text',
   'tableColumnId': 29669786,
   'width': 160},
  {'cachedContents': {'cardinality': '84',
    'largest': 'Vietnamese/Cambodian/Malaysia',
    'not_null': '418685',
    'null': '0',
    'smallest': 'Afghan',
    'top': [{'count': '96424', 'item': 'American'},
     {'count': '44248', 'item': 'Chinese'},
     {'count': '20047',
      'item': 'Latin (Cuban, Dominican, Puerto Rican, South & Central American)'},
     {'count': '19738', 'item': 'Pizza'},
     {'count': '19294', 'item': 'Italian'},
     {'count': '15840', 'item': 'Mexican'},
     {'count': '15766', 'item': 'Café/Coffee/Tea'},
     {'count': '15019', 'item': 'Japanese'},
     {'count': '13294', 'item': 'Caribbean'},
     {'count': '12332', 'item': 'Bakery'},
     {'count': '12079', 'item': 'Spanish'},
     {'count': '9194', 'item': 'Pizza/Italian'},
     {'count': '6526', 'item': 'Delicatessen'},
     {'count': '6501', 'item': 'Asian'},
     {'count': '6486', 'item': 'Chicken'},
     {'count': '6374', 'item': 'Indian'},
     {'count': '6195', 'item': 'Jewish/Kosher'},
     {'count': '5791', 'item': 'French'},
     {'count': '5764', 'item': 'Thai'},
     {'count': '5724', 'item': 'Donuts'}]},
   'dataTypeName': 'text',
   'description': 'This field describes the entity (restaurant) cuisine.',
   'fieldName': 'cuisine_description',
   'format': {'align': 'left'},
   'id': 212407250,
   'name': 'CUISINE DESCRIPTION',
   'position': 8,
   'renderTypeName': 'text',
   'tableColumnId': 29669787,
   'width': 328},
  {'cachedContents': {'cardinality': '1405',
    'largest': '2017-05-06T00:00:00.000',
    'not_null': '418685',
    'null': '0',
    'smallest': '1900-01-01T00:00:00.000',
    'top': [{'count': '911', 'item': '1900-01-01T00:00:00.000'},
     {'count': '733', 'item': '2015-04-16T00:00:00.000'},
     {'count': '725', 'item': '2015-04-15T00:00:00.000'},
     {'count': '720', 'item': '2015-04-02T00:00:00.000'},
     {'count': '718', 'item': '2015-03-24T00:00:00.000'},
     {'count': '695', 'item': '2015-05-13T00:00:00.000'},
     {'count': '691', 'item': '2015-02-12T00:00:00.000'},
     {'count': '688', 'item': '2015-03-25T00:00:00.000'},
     {'count': '683', 'item': '2017-04-25T00:00:00.000'},
     {'count': '682', 'item': '2015-02-10T00:00:00.000'},
     {'count': '681', 'item': '2016-08-16T00:00:00.000'},
     {'count': '676', 'item': '2014-12-17T00:00:00.000'},
     {'count': '676', 'item': '2016-05-26T00:00:00.000'},
     {'count': '672', 'item': '2014-10-30T00:00:00.000'},
     {'count': '669', 'item': '2014-12-04T00:00:00.000'},
     {'count': '666', 'item': '2015-04-09T00:00:00.000'},
     {'count': '666', 'item': '2015-02-05T00:00:00.000'},
     {'count': '665', 'item': '2015-05-07T00:00:00.000'},
     {'count': '664', 'item': '2017-03-16T00:00:00.000'},
     {'count': '661', 'item': '2016-05-25T00:00:00.000'}]},
   'dataTypeName': 'calendar_date',
   'description': 'This field represents the date of inspection',
   'fieldName': 'inspection_date',
   'format': {'align': 'left', 'view': 'date'},
   'id': 212407251,
   'name': 'INSPECTION DATE',
   'position': 9,
   'renderTypeName': 'calendar_date',
   'tableColumnId': 29669788,
   'width': 211},
  {'cachedContents': {'cardinality': '5',
    'largest': 'Violations were cited in the following area(s).',
    'not_null': '417774',
    'null': '911',
    'smallest': 'Establishment Closed by DOHMH.  Violations were cited in the following area(s) and those requiring immediate action were addressed.',
    'top': [{'count': '399161',
      'item': 'Violations were cited in the following area(s).'},
     {'count': '8998',
      'item': 'Establishment Closed by DOHMH.  Violations were cited in the following area(s) and those requiring immediate action were addressed.'},
     {'count': '6202',
      'item': 'No violations were recorded at the time of this inspection.'},
     {'count': '2675', 'item': 'Establishment re-opened by DOHMH'},
     {'count': '738', 'item': 'Establishment re-closed by DOHMH'}]},
   'dataTypeName': 'text',
   'description': 'This field represents the actions that is associated with each restaurant inspection.',
   'fieldName': 'action',
   'format': {'align': 'left'},
   'id': 212407252,
   'name': 'ACTION',
   'position': 10,
   'renderTypeName': 'text',
   'tableColumnId': 29669789,
   'width': 484},
  {'cachedContents': {'cardinality': '94',
    'largest': '22G',
    'not_null': '411619',
    'null': '7066',
    'smallest': '02A',
    'top': [{'count': '58624', 'item': '10F'},
     {'count': '41048', 'item': '08A'},
     {'count': '29970', 'item': '02G'},
     {'count': '29254', 'item': '04L'},
     {'count': '26964', 'item': '06D'},
     {'count': '26126', 'item': '06C'},
     {'count': '22886', 'item': '10B'},
     {'count': '20468', 'item': '02B'},
     {'count': '19331', 'item': '04N'},
     {'count': '9556', 'item': '04H'},
     {'count': '9440', 'item': '04M'},
     {'count': '9343', 'item': '06E'},
     {'count': '8103', 'item': '06F'},
     {'count': '7726', 'item': '06A'},
     {'count': '7640', 'item': '04A'},
     {'count': '6788', 'item': '10H'},
     {'count': '5089', 'item': '09C'},
     {'count': '4974', 'item': '15L'},
     {'count': '4934', 'item': '08C'},
     {'count': '4221', 'item': '02H'}]},
   'dataTypeName': 'text',
   'description': 'This field represents the violation codes that is associated with each restaurant inspection.',
   'fieldName': 'violation_code',
   'format': {'align': 'left'},
   'id': 212407253,
   'name': 'VIOLATION CODE',
   'position': 11,
   'renderTypeName': 'text',
   'tableColumnId': 29669790,
   'width': 268},
  {'cachedContents': {'cardinality': '92',
    'largest': 'Wiping cloths soiled or not stored in sanitizing solution.',
    'not_null': '411318',
    'null': '7367',
    'smallest': 'Accurate thermometer not provided in refrigerated or hot holding equipment.',
    'top': [{'count': '58624',
      'item': 'Non-food contact surface improperly constructed. Unacceptable material used. Non-food contact surface or equipment improperly maintained and/or not properly sealed, raised, spaced or movable to allow accessibility for cleaning on all sides, above and underneath the unit.'},
     {'count': '41048',
      'item': 'Facility not vermin proof. Harborage or conditions conducive to attracting vermin to the premises and/or allowing vermin to exist.'},
     {'count': '29970',
      'item': 'Cold food item held above 41º F (smoked fish and reduced oxygen packaged foods above 38 ºF) except during necessary preparation.'},
     {'count': '29254',
      'item': "Evidence of mice or live mice present in facility's food and/or non-food areas."},
     {'count': '26964',
      'item': 'Food contact surface not properly washed, rinsed and sanitized after each use and following any activity when contamination may have occurred.'},
     {'count': '26126',
      'item': 'Food not protected from potential source of contamination during storage, preparation, transportation, display or service.'},
     {'count': '22886',
      'item': 'Plumbing not properly installed or maintained; anti-siphonage or backflow prevention device not provided where required; equipment or floor not properly drained; sewage disposal system in disrepair or not functioning properly.'},
     {'count': '20468', 'item': 'Hot food item not held at or above 140º F.'},
     {'count': '19331',
      'item': 'Filth flies or food/refuse/sewage-associated (FRSA) flies present in facility\x1as food and/or non-food areas. Filth flies include house flies, little house flies, blow flies, bottle flies and flesh flies. Food/refuse/sewage-associated flies include fruit flies, drain flies and Phorid flies.'},
     {'count': '9556',
      'item': 'Raw, cooked or prepared food is adulterated, contaminated, cross-contaminated, or not discarded in accordance with HACCP plan.'},
     {'count': '9440',
      'item': "Live roaches present in facility's food and/or non-food areas."},
     {'count': '9343',
      'item': 'Sanitized equipment or utensil, including in-use food dispensing utensil, improperly used or stored.'},
     {'count': '8103',
      'item': 'Wiping cloths soiled or not stored in sanitizing solution.'},
     {'count': '7726',
      'item': 'Personal cleanliness inadequate. Outer garment soiled with possible contaminant.  Effective hair restraint not worn in an area where food is prepared.'},
     {'count': '7640',
      'item': 'Food Protection Certificate not held by supervisor of food operations.'},
     {'count': '6788',
      'item': 'Proper sanitization not provided for utensil ware washing operation.'},
     {'count': '5089',
      'item': 'Food contact surface not properly maintained.'},
     {'count': '4974',
      'item': 'Smoke free workplace smoking policy inadequate, not posted, not provided to employees.'},
     {'count': '4934',
      'item': 'Pesticide use not in accordance with label or applicable laws. Prohibited chemical used/stored. Open bait station used.'},
     {'count': '4221',
      'item': 'Food not cooled by an approved method whereby the internal product temperature is reduced from 140º F to 70º F or less within 2 hours, and from 70º F to 41º F or less within 4 additional hours.'}]},
   'dataTypeName': 'text',
   'description': 'This field is the description that corresponds to the violation codes',
   'fieldName': 'violation_description',
   'format': {'align': 'left'},
   'id': 212407254,
   'name': 'VIOLATION DESCRIPTION',
   'position': 12,
   'renderTypeName': 'text',
   'tableColumnId': 29669791,
   'width': 723},
  {'cachedContents': {'cardinality': '3',
    'largest': 'Not Critical',
    'not_null': '418685',
    'null': '0',
    'smallest': 'Critical',
    'top': [{'count': '229355', 'item': 'Critical'},
     {'count': '181963', 'item': 'Not Critical'},
     {'count': '7367', 'item': 'Not Applicable'}]},
   'dataTypeName': 'text',
   'description': 'This indicates if Violation is critical or not.',
   'fieldName': 'critical_flag',
   'format': {'align': 'left'},
   'id': 212407255,
   'name': 'CRITICAL FLAG',
   'position': 13,
   'renderTypeName': 'text',
   'tableColumnId': 29669792,
   'width': 260},
  {'cachedContents': {'cardinality': '119',
    'largest': '138',
    'not_null': '393491',
    'null': '25194',
    'smallest': '-2',
    'top': [{'count': '40382', 'item': '12'},
     {'count': '27262', 'item': '13'},
     {'count': '24832', 'item': '10'},
     {'count': '23615', 'item': '11'},
     {'count': '22835', 'item': '9'},
     {'count': '16596', 'item': '7'},
     {'count': '12820', 'item': '19'},
     {'count': '12713', 'item': '17'},
     {'count': '12003', 'item': '20'},
     {'count': '11307', 'item': '22'},
     {'count': '11199', 'item': '18'},
     {'count': '10888', 'item': '21'},
     {'count': '9743', 'item': '24'},
     {'count': '9031', 'item': '23'},
     {'count': '8552', 'item': '25'},
     {'count': '8530', 'item': '8'},
     {'count': '8014', 'item': '16'},
     {'count': '7834', 'item': '26'},
     {'count': '7324', 'item': '15'},
     {'count': '7223', 'item': '27'}]},
   'dataTypeName': 'number',
   'description': 'Total Score for a particular inspection.   If there was adjudication a judge may reduce the  total points for the inspection and this field will have the update amount.',
   'fieldName': 'score',
   'format': {'align': 'left',
    'noCommas': 'true',
    'precisionStyle': 'standard'},
   'id': 212407256,
   'name': 'SCORE',
   'position': 14,
   'renderTypeName': 'number',
   'tableColumnId': 29669793,
   'width': 160},
  {'cachedContents': {'cardinality': '7',
    'largest': 'Z',
    'not_null': '204149',
    'null': '214536',
    'smallest': 'A',
    'top': [{'count': '160135', 'item': 'A'},
     {'count': '30934', 'item': 'B'},
     {'count': '7689', 'item': 'C'},
     {'count': '2437', 'item': 'Z'},
     {'count': '1591', 'item': 'Not Yet Graded'},
     {'count': '1357', 'item': 'P'},
     {'count': '6', 'item': 'G'}]},
   'dataTypeName': 'text',
   'description': '• N = Not Yet Graded\n• A = Grade A\n• B = Grade B\n• C = Grade C\n• Z = Grade Pending\n• P= Grade Pending issued on re-opening following an initial inspection that resulted in a closure\n',
   'fieldName': 'grade',
   'format': {'align': 'left'},
   'id': 212407257,
   'name': 'GRADE',
   'position': 15,
   'renderTypeName': 'text',
   'tableColumnId': 29669794,
   'width': 160},
  {'cachedContents': {'cardinality': '1317',
    'largest': '2017-05-06T00:00:00.000',
    'not_null': '202562',
    'null': '216123',
    'smallest': '2012-05-01T00:00:00.000',
    'top': [{'count': '474', 'item': '2016-08-24T00:00:00.000'},
     {'count': '448', 'item': '2014-06-26T00:00:00.000'},
     {'count': '445', 'item': '2015-05-28T00:00:00.000'},
     {'count': '437', 'item': '2016-08-25T00:00:00.000'},
     {'count': '431', 'item': '2014-06-25T00:00:00.000'},
     {'count': '430', 'item': '2016-08-23T00:00:00.000'},
     {'count': '428', 'item': '2015-05-20T00:00:00.000'},
     {'count': '428', 'item': '2015-05-26T00:00:00.000'},
     {'count': '411', 'item': '2015-04-02T00:00:00.000'},
     {'count': '410', 'item': '2015-05-27T00:00:00.000'},
     {'count': '405', 'item': '2017-01-19T00:00:00.000'},
     {'count': '397', 'item': '2015-05-21T00:00:00.000'},
     {'count': '374', 'item': '2015-04-16T00:00:00.000'},
     {'count': '373', 'item': '2016-08-22T00:00:00.000'},
     {'count': '366', 'item': '2015-04-07T00:00:00.000'},
     {'count': '362', 'item': '2015-06-01T00:00:00.000'},
     {'count': '362', 'item': '2017-05-02T00:00:00.000'},
     {'count': '361', 'item': '2017-03-16T00:00:00.000'},
     {'count': '354', 'item': '2015-03-24T00:00:00.000'},
     {'count': '353', 'item': '2016-06-22T00:00:00.000'}]},
   'dataTypeName': 'calendar_date',
   'description': 'The date when the current grade was issued to the entity (restaurant)',
   'fieldName': 'grade_date',
   'format': {'align': 'left', 'view': 'date'},
   'id': 212407258,
   'name': 'GRADE DATE',
   'position': 16,
   'renderTypeName': 'calendar_date',
   'tableColumnId': 29669795,
   'width': 220},
  {'cachedContents': {'cardinality': '3',
    'largest': '2017-05-08T06:00:50.000',
    'not_null': '418685',
    'null': '0',
    'smallest': '2017-05-08T06:00:45.000',
    'top': [{'count': '414974', 'item': '2017-05-08T06:00:45.000'},
     {'count': '2800', 'item': '2017-05-08T06:00:48.000'},
     {'count': '911', 'item': '2017-05-08T06:00:50.000'}]},
   'dataTypeName': 'calendar_date',
   'description': 'The date when the extract was run to produce this data set',
   'fieldName': 'record_date',
   'format': {'align': 'left', 'view': 'date'},
   'id': 212407259,
   'name': 'RECORD DATE',
   'position': 17,
   'renderTypeName': 'calendar_date',
   'tableColumnId': 29669796,
   'width': 232},
  {'cachedContents': {'cardinality': '34',
    'largest': 'Trans Fat / Second Compliance Inspection',
    'not_null': '417774',
    'null': '911',
    'smallest': 'Administrative Miscellaneous / Compliance Inspection',
    'top': [{'count': '237613',
      'item': 'Cycle Inspection / Initial Inspection'},
     {'count': '107514', 'item': 'Cycle Inspection / Re-inspection'},
     {'count': '25079',
      'item': 'Pre-permit (Operational) / Initial Inspection'},
     {'count': '11345', 'item': 'Pre-permit (Operational) / Re-inspection'},
     {'count': '8742',
      'item': 'Administrative Miscellaneous / Initial Inspection'},
     {'count': '4593', 'item': 'Smoke-Free Air Act / Initial Inspection'},
     {'count': '4181',
      'item': 'Pre-permit (Non-operational) / Initial Inspection'},
     {'count': '3277', 'item': 'Trans Fat / Initial Inspection'},
     {'count': '3184', 'item': 'Cycle Inspection / Reopening Inspection'},
     {'count': '3046', 'item': 'Administrative Miscellaneous / Re-inspection'},
     {'count': '1818', 'item': 'Smoke-Free Air Act / Re-inspection'},
     {'count': '1548', 'item': 'Cycle Inspection / Compliance Inspection'},
     {'count': '1435', 'item': 'Trans Fat / Re-inspection'},
     {'count': '1214', 'item': 'Inter-Agency Task Force / Initial Inspection'},
     {'count': '836',
      'item': 'Pre-permit (Operational) / Compliance Inspection'},
     {'count': '550',
      'item': 'Pre-permit (Operational) / Reopening Inspection'},
     {'count': '511', 'item': 'Trans Fat / Compliance Inspection'},
     {'count': '304', 'item': 'Pre-permit (Non-operational) / Re-inspection'},
     {'count': '240',
      'item': 'Administrative Miscellaneous / Compliance Inspection'},
     {'count': '192', 'item': 'Calorie Posting / Initial Inspection'}]},
   'dataTypeName': 'text',
   'description': 'The type of inspection.  A combination of the program and inspection type.',
   'fieldName': 'inspection_type',
   'format': {'align': 'left'},
   'id': 212407260,
   'name': 'INSPECTION TYPE',
   'position': 18,
   'renderTypeName': 'text',
   'tableColumnId': 29669797,
   'width': 280}],
 'createdAt': 1425677589,
 'description': 'This dataset provides restaurant inspections, violations, grades and adjudication information',
 'downloadCount': 156,
 'flags': ['default', 'restorable', 'restorePossibleForType'],
 'grants': [{'flags': ['public'], 'inherited': False, 'type': 'viewer'}],
 'hideFromCatalog': False,
 'hideFromDataJson': False,
 'id': '9w7m-hzhe',
 'metadata': {'availableDisplayTypes': ['table', 'fatrow', 'page'],
  'custom_fields': {'Dataset Information': {'Agency': 'Department of Health and Mental Hygiene (DOHMH)'},
   'Update': {'Automation': 'Yes', 'Update Frequency': 'Daily'}},
  'jsonQuery': {'order': [{'ascending': True, 'columnFieldName': 'camis'},
    {'ascending': False, 'columnFieldName': 'inspection_date'},
    {'ascending': True, 'columnFieldName': 'violation_code'}]},
  'rdfSubject': '0',
  'renderTypeConfig': {'visible': {'table': True}},
  'rowLabel': 'Row'},
 'name': 'DOHMH New York City Restaurant Inspection Results',
 'newBackend': True,
 'numberOfComments': 0,
 'oid': 12209632,
 'owner': {'displayName': 'NYC OpenData',
  'id': '5fuc-pqz2',
  'lastNotificationSeenAt': 1493054292,
  'rights': ['create_datasets',
   'edit_others_datasets',
   'edit_sdp',
   'edit_site_theme',
   'moderate_comments',
   'manage_users',
   'chown_datasets',
   'edit_nominations',
   'approve_nominations',
   'feature_items',
   'federations',
   'manage_stories',
   'manage_approval',
   'change_configurations',
   'view_domain',
   'view_others_datasets',
   'edit_pages',
   'create_pages',
   'view_goals',
   'view_dashboards',
   'edit_goals',
   'edit_dashboards',
   'create_dashboards',
   'manage_provenance',
   'create_story',
   'edit_story_title_desc',
   'create_story_copy',
   'delete_story',
   'manage_story_collaborators',
   'manage_story_visibility',
   'manage_story_public_version',
   'edit_story',
   'view_unpublished_story',
   'view_story',
   'view_all_dataset_status_logs',
   'use_data_connectors'],
  'roleName': 'administrator',
  'screenName': 'NYC OpenData'},
 'provenance': 'official',
 'publicationAppendEnabled': False,
 'publicationDate': 1436568081,
 'publicationGroup': 2430087,
 'publicationStage': 'published',
 'query': {},
 'rights': ['read'],
 'rowsUpdatedAt': 1494272846,
 'rowsUpdatedBy': '5fuc-pqz2',
 'tableAuthor': {'displayName': 'NYC OpenData',
  'id': '5fuc-pqz2',
  'lastNotificationSeenAt': 1493054292,
  'rights': ['create_datasets',
   'edit_others_datasets',
   'edit_sdp',
   'edit_site_theme',
   'moderate_comments',
   'manage_users',
   'chown_datasets',
   'edit_nominations',
   'approve_nominations',
   'feature_items',
   'federations',
   'manage_stories',
   'manage_approval',
   'change_configurations',
   'view_domain',
   'view_others_datasets',
   'edit_pages',
   'create_pages',
   'view_goals',
   'view_dashboards',
   'edit_goals',
   'edit_dashboards',
   'create_dashboards',
   'manage_provenance',
   'create_story',
   'edit_story_title_desc',
   'create_story_copy',
   'delete_story',
   'manage_story_collaborators',
   'manage_story_visibility',
   'manage_story_public_version',
   'edit_story',
   'view_unpublished_story',
   'view_story',
   'view_all_dataset_status_logs',
   'use_data_connectors'],
  'roleName': 'administrator',
  'screenName': 'NYC OpenData'},
 'tableId': 3512035,
 'tags': ['restaurant',
  'inspection',
  'violation',
  'grade',
  'adjudication',
  'fines'],
 'totalTimesRated': 0,
 'viewCount': 0,
 'viewLastModified': 1494307996,
 'viewType': 'tabular'}

First 10 data rows

In [7]:
data = pd.DataFrame.from_dict(client.get(id, content_type='json', limit=1000))
In [8]:
data.head(10)
Out[8]:
action boro building camis critical_flag cuisine_description dba grade grade_date inspection_date inspection_type phone record_date score street violation_code violation_description zipcode
0 Violations were cited in the following area(s). QUEENS 0 41142665 Not Critical Donuts DUNKIN' DONUTS, BASKIN ROBBINS A 2017-02-08T00:00:00.000 2017-02-08T00:00:00.000 Cycle Inspection / Initial Inspection 7183356473 2017-05-08T06:00:45.000 4 LAGUARDIA AIRPORT 10F Non-food contact surface improperly constructe... 11371
1 Violations were cited in the following area(s). MANHATTAN 4 40701525 Not Critical American SKADDEN ARPS, SLATE A 2015-02-06T00:00:00.000 2015-02-06T00:00:00.000 Cycle Inspection / Initial Inspection 2127355243 2017-05-08T06:00:45.000 10 TIMES SQUARE 10F Non-food contact surface improperly constructe... 10036
2 Violations were cited in the following area(s). MANHATTAN 157 41372868 Critical Japanese MOMOKAWA A 2015-05-06T00:00:00.000 2015-05-06T00:00:00.000 Cycle Inspection / Initial Inspection 2126847830 2017-05-08T06:00:45.000 10 EAST 28 STREET 02H Food not cooled by an approved method whereby ... 10016
3 Violations were cited in the following area(s). MANHATTAN 55 41222773 Critical Donuts DUNKIN' DONUTS, BASKIN ROBBINS NaN NaN 2015-05-11T00:00:00.000 Cycle Inspection / Initial Inspection 2122454655 2017-05-08T06:00:45.000 24 WEST 55 STREET 06F Wiping cloths soiled or not stored in sanitizi... 10019
4 Violations were cited in the following area(s). QUEENS 133-18 50002976 Not Critical American CHECKERS NaN NaN 2017-02-10T00:00:00.000 Cycle Inspection / Initial Inspection 7184135599 2017-05-08T06:00:45.000 12 GUY R BREWER BLVD 10B Plumbing not properly installed or maintained;... 11434
5 Violations were cited in the following area(s). BROOKLYN 2882 50054355 Critical Bottled beverages, including water, sodas, jui... GERRITTSEN BEACH CATHOLIC CLUB NaN NaN 2017-03-09T00:00:00.000 Pre-permit (Operational) / Compliance Inspection 7189342364 2017-05-08T06:00:45.000 15 GERRITSEN AVE 04N Filth flies or food/refuse/sewage-associated (... 11229
6 Violations were cited in the following area(s). BROOKLYN 2933 41662783 Not Critical Spanish EL TIPICO NaN NaN 2014-12-02T00:00:00.000 Cycle Inspection / Initial Inspection 7182772560 2017-05-08T06:00:45.000 16 FULTON STREET 09C Food contact surface not properly maintained. 11207
7 Violations were cited in the following area(s). BROOKLYN 139 41040405 Critical Hamburgers MCDONALD'S B 2014-01-29T00:00:00.000 2014-01-29T00:00:00.000 Cycle Inspection / Re-inspection 7182300176 2017-05-08T06:00:45.000 23 FLATBUSH AVENUE 04M Live roaches present in facility's food and/or... 11217
8 Violations were cited in the following area(s). MANHATTAN 37 41200526 Not Critical Korean SHILLA KOREAN BARBECUE HOUSE NaN NaN 2013-04-09T00:00:00.000 Cycle Inspection / Initial Inspection 2129671880 2017-05-08T06:00:45.000 17 WEST 32 STREET 10B Plumbing not properly installed or maintained;... 10001
9 Violations were cited in the following area(s). MANHATTAN 27 40729264 Critical Irish PLAYWRIGHT TAVERN NaN NaN 2015-10-14T00:00:00.000 Cycle Inspection / Initial Inspection 2122688868 2017-05-08T06:00:45.000 24 WEST 35 STREET 02G Cold food item held above 41º F (smoked fish ... 10001

What's next?

Go Down the Rabbit Hole

Such as watching some cool YouTube Videos and learn to hack from masters.

Chicago Food Inspections hack

Builtin Superheroes

David Beazley

Keynote: PyData Chicago 2016. August 28, 2016.

http://www.dabeaz.com/talks.html

In [9]:
from IPython.display import YouTubeVideo
from datetime import timedelta
id = 'j6VSAsKAj98'
YouTubeVideo(id, start=int(timedelta(hours=0, minutes=17, seconds=24).total_seconds()))
Out[9]: