eland/docs/source/examples/introduction_to_eland_webinar.ipynb
2020-09-03 09:06:59 -05:00

2805 lines
136 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Introduction to Eland Webinar\n",
"\n",
"- [Webinar Recording on Youtube](https://www.youtube.com/watch?v=U8fnkzp_sfo)\n",
"- [Eland Documentation](https://eland.readthedocs.io)\n",
"- [Source Code on GitHub](https://github.com/elastic/eland)\n",
"- [Elastic Cloud](https://cloud.elastic.co)\n",
"- [NYC Open Data dataset](https://data.cityofnewyork.us/Health/DOHMH-New-York-City-Restaurant-Inspection-Results/43nn-pn8j)\n",
"\n",
"This Jupyter Notebook goes along with the webinar 'Introduction to Eland' which is available\n",
"on Youtube. To follow along either create an Elasticsearch deployment on Elastic Cloud (free trial available)\n",
"or start your own Elasticsearch cluster locally.\n",
"\n",
"You'll need to install the following libraries:\n",
"\n",
"```bash\n",
"$ python -m pip install eland numpy pandas\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## DataFrame Demo"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"# Standard imports\n",
"import eland as ed\n",
"import pandas as pd\n",
"import numpy as np\n",
"from elasticsearch import Elasticsearch\n",
"\n",
"# Function for pretty-printing JSON\n",
"def json(x):\n",
" import json\n",
" print(json.dumps(x, indent=2, sort_keys=True))"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"cluster_name\": \"167e473c7bba4bae85004385d4e0ce46\",\n",
" \"cluster_uuid\": \"4Y2FwBhRSsWq9uGedb1DmQ\",\n",
" \"name\": \"instance-0000000000\",\n",
" \"tagline\": \"You Know, for Search\",\n",
" \"version\": {\n",
" \"build_date\": \"2020-06-14T19:35:50.234439Z\",\n",
" \"build_flavor\": \"default\",\n",
" \"build_hash\": \"757314695644ea9a1dc2fecd26d1a43856725e65\",\n",
" \"build_snapshot\": false,\n",
" \"build_type\": \"docker\",\n",
" \"lucene_version\": \"8.5.1\",\n",
" \"minimum_index_compatibility_version\": \"6.0.0-beta1\",\n",
" \"minimum_wire_compatibility_version\": \"6.8.0\",\n",
" \"number\": \"7.8.0\"\n",
" }\n",
"}\n"
]
}
],
"source": [
"# Connect to an Elastic Cloud instance\n",
"# or another Elasticsearch index below\n",
"\n",
"ELASTIC_CLOUD_ID = \"<cloud-id>\"\n",
"ELASTIC_CLOUD_PASSWORD = \"<password>\"\n",
"\n",
"es = Elasticsearch(\n",
" cloud_id=ELASTIC_CLOUD_ID,\n",
" http_auth=(\"elastic\", ELASTIC_CLOUD_PASSWORD) \n",
")\n",
"json(es.info())"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Int64Index: 193197 entries, 0 to 400255\n",
"Data columns (total 26 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 CAMIS 193197 non-null int64 \n",
" 1 DBA 193197 non-null object \n",
" 2 BORO 193197 non-null object \n",
" 3 BUILDING 193197 non-null object \n",
" 4 STREET 193197 non-null object \n",
" 5 ZIPCODE 193197 non-null float64\n",
" 6 PHONE 193197 non-null object \n",
" 7 CUISINE DESCRIPTION 193197 non-null object \n",
" 8 INSPECTION DATE 193197 non-null object \n",
" 9 ACTION 193197 non-null object \n",
" 10 VIOLATION CODE 193197 non-null object \n",
" 11 VIOLATION DESCRIPTION 193197 non-null object \n",
" 12 CRITICAL FLAG 193197 non-null object \n",
" 13 SCORE 193197 non-null float64\n",
" 14 GRADE 193197 non-null object \n",
" 15 GRADE DATE 193197 non-null object \n",
" 16 RECORD DATE 193197 non-null object \n",
" 17 INSPECTION TYPE 193197 non-null object \n",
" 18 Latitude 193197 non-null float64\n",
" 19 Longitude 193197 non-null float64\n",
" 20 Community Board 193197 non-null float64\n",
" 21 Council District 193197 non-null float64\n",
" 22 Census Tract 193197 non-null float64\n",
" 23 BIN 193197 non-null float64\n",
" 24 BBL 193197 non-null float64\n",
" 25 NTA 193197 non-null object \n",
"dtypes: float64(9), int64(1), object(16)\n",
"memory usage: 39.8+ MB\n"
]
}
],
"source": [
"# Load the dataset from NYC Open Data and take a look\n",
"pd_df = pd.read_csv(\"nyc-restaurants.csv\").dropna()\n",
"pd_df.info()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Int64Index: 193197 entries, 0 to 400255\n",
"Data columns (total 25 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 camis 193197 non-null int64 \n",
" 1 dba 193197 non-null object \n",
" 2 boro 193197 non-null object \n",
" 3 building 193197 non-null object \n",
" 4 street 193197 non-null object \n",
" 5 zipcode 193197 non-null float64\n",
" 6 phone 193197 non-null object \n",
" 7 cuisine_description 193197 non-null object \n",
" 8 inspection_date 193197 non-null object \n",
" 9 action 193197 non-null object \n",
" 10 violation_code 193197 non-null object \n",
" 11 violation_description 193197 non-null object \n",
" 12 critical_flag 193197 non-null object \n",
" 13 score 193197 non-null float64\n",
" 14 grade 193197 non-null object \n",
" 15 grade_date 193197 non-null object \n",
" 16 record_date 193197 non-null object \n",
" 17 inspection_type 193197 non-null object \n",
" 18 community_board 193197 non-null float64\n",
" 19 council_district 193197 non-null float64\n",
" 20 census_tract 193197 non-null float64\n",
" 21 bin 193197 non-null float64\n",
" 22 bbl 193197 non-null float64\n",
" 23 nta 193197 non-null object \n",
" 24 location 193197 non-null object \n",
"dtypes: float64(7), int64(1), object(17)\n",
"memory usage: 38.3+ MB\n"
]
}
],
"source": [
"# Rename the columns to be snake_case\n",
"pd_df.columns = [x.lower().replace(\" \", \"_\") for x in pd_df.columns]\n",
"\n",
"# Combine the 'latitude' and 'longitude' columns into one column 'location' for 'geo_point'\n",
"pd_df[\"location\"] = pd_df[[\"latitude\", \"longitude\"]].apply(lambda x: \",\".join(str(item) for item in x), axis=1)\n",
"\n",
"# Drop the old columns in favor of 'location'\n",
"pd_df.drop([\"latitude\", \"longitude\"], axis=1, inplace=True)\n",
"\n",
"pd_df.info()"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'eland.dataframe.DataFrame'>\n",
"Index: 193197 entries, 10388 to 398749\n",
"Data columns (total 25 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 camis 193197 non-null int64 \n",
" 1 dba 193197 non-null object \n",
" 2 boro 193197 non-null object \n",
" 3 building 193197 non-null object \n",
" 4 street 193197 non-null object \n",
" 5 zipcode 193197 non-null int64 \n",
" 6 phone 193197 non-null object \n",
" 7 cuisine_description 193197 non-null object \n",
" 8 inspection_date 193197 non-null object \n",
" 9 action 193197 non-null object \n",
" 10 violation_code 193197 non-null object \n",
" 11 violation_description 193197 non-null object \n",
" 12 critical_flag 193197 non-null object \n",
" 13 score 193197 non-null float64\n",
" 14 grade 193197 non-null object \n",
" 15 grade_date 193197 non-null object \n",
" 16 record_date 193197 non-null object \n",
" 17 inspection_type 193197 non-null object \n",
" 18 community_board 193197 non-null float64\n",
" 19 council_district 193197 non-null float64\n",
" 20 census_tract 193197 non-null float64\n",
" 21 bin 193197 non-null float64\n",
" 22 bbl 193197 non-null float64\n",
" 23 nta 193197 non-null object \n",
" 24 location 193197 non-null object \n",
"dtypes: float64(6), int64(2), object(17)\n",
"memory usage: 80.0 bytes\n"
]
}
],
"source": [
"df = ed.pandas_to_eland(\n",
" pd_df=pd_df,\n",
" es_client=es,\n",
"\n",
" # Where the data will live in Elasticsearch\n",
" es_dest_index=\"nyc-restaurants\",\n",
" \n",
" # Type overrides for certain columns, 'location' detected\n",
" # automatically as 'keyword' but we want these interpreted as 'geo_point'.\n",
" es_type_overrides={\n",
" \"location\": \"geo_point\",\n",
" \"dba\": \"text\",\n",
" \"zipcode\": \"short\"\n",
" },\n",
"\n",
" # If the index already exists what should we do?\n",
" es_if_exists=\"replace\",\n",
" \n",
" # Wait for data to be indexed before returning\n",
" es_refresh=True,\n",
")\n",
"df.info()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"nyc-restaurants\": {\n",
" \"mappings\": {\n",
" \"properties\": {\n",
" \"action\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"bbl\": {\n",
" \"type\": \"double\"\n",
" },\n",
" \"bin\": {\n",
" \"type\": \"double\"\n",
" },\n",
" \"boro\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"building\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"camis\": {\n",
" \"type\": \"long\"\n",
" },\n",
" \"census_tract\": {\n",
" \"type\": \"double\"\n",
" },\n",
" \"community_board\": {\n",
" \"type\": \"double\"\n",
" },\n",
" \"council_district\": {\n",
" \"type\": \"double\"\n",
" },\n",
" \"critical_flag\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"cuisine_description\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"dba\": {\n",
" \"type\": \"text\"\n",
" },\n",
" \"grade\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"grade_date\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"inspection_date\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"inspection_type\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"location\": {\n",
" \"type\": \"geo_point\"\n",
" },\n",
" \"nta\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"phone\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"record_date\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"score\": {\n",
" \"type\": \"double\"\n",
" },\n",
" \"street\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"violation_code\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"violation_description\": {\n",
" \"type\": \"keyword\"\n",
" },\n",
" \"zipcode\": {\n",
" \"type\": \"short\"\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n"
]
}
],
"source": [
"json(es.indices.get_mapping(index=\"nyc-restaurants\"))"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(193197, 25)"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Shape is determined by using count API\n",
"df.shape"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"es_index_pattern: nyc-restaurants\n",
"Index:\n",
" es_index_field: _id\n",
" is_source_field: False\n",
"Mappings:\n",
" capabilities:\n",
" es_field_name is_source es_dtype es_date_format pd_dtype is_searchable is_aggregatable is_scripted aggregatable_es_field_name\n",
"camis camis True long None int64 True True False camis\n",
"dba dba True text None object True False False None\n",
"boro boro True keyword None object True True False boro\n",
"building building True keyword None object True True False building\n",
"street street True keyword None object True True False street\n",
"zipcode zipcode True short None int64 True True False zipcode\n",
"phone phone True keyword None object True True False phone\n",
"cuisine_description cuisine_description True keyword None object True True False cuisine_description\n",
"inspection_date inspection_date True keyword None object True True False inspection_date\n",
"action action True keyword None object True True False action\n",
"violation_code violation_code True keyword None object True True False violation_code\n",
"violation_description violation_description True keyword None object True True False violation_description\n",
"critical_flag critical_flag True keyword None object True True False critical_flag\n",
"score score True double None float64 True True False score\n",
"grade grade True keyword None object True True False grade\n",
"grade_date grade_date True keyword None object True True False grade_date\n",
"record_date record_date True keyword None object True True False record_date\n",
"inspection_type inspection_type True keyword None object True True False inspection_type\n",
"community_board community_board True double None float64 True True False community_board\n",
"council_district council_district True double None float64 True True False council_district\n",
"census_tract census_tract True double None float64 True True False census_tract\n",
"bin bin True double None float64 True True False bin\n",
"bbl bbl True double None float64 True True False bbl\n",
"nta nta True keyword None object True True False nta\n",
"location location True geo_point None object True True False location\n",
"Operations:\n",
" tasks: [('tail': ('sort_field': '_doc', 'count': 10))]\n",
" size: 10\n",
" sort_params: _doc:desc\n",
" _source: ['camis', 'dba', 'boro', 'building', 'street', 'zipcode', 'phone', 'cuisine_description', 'inspection_date', 'action', 'violation_code', 'violation_description', 'critical_flag', 'score', 'grade', 'grade_date', 'record_date', 'inspection_type', 'community_board', 'council_district', 'census_tract', 'bin', 'bbl', 'nta', 'location']\n",
" body: {}\n",
" post_processing: [('sort_index')]\n",
"\n"
]
}
],
"source": [
"# DataFrame has many APIs compatible with Pandas\n",
"\n",
"#df.head(10)\n",
"#df.columns\n",
"#df.dba\n",
"#df[\"grade\"]\n",
"#df[df.grade.isin([\"A\", \"B\"])]\n",
"#print(df[df.grade.isin([\"A\", \"B\"])].es_info())\n",
"#print(df.tail(10).es_info())"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>camis</th>\n",
" <th>zipcode</th>\n",
" <th>score</th>\n",
" <th>community_board</th>\n",
" <th>council_district</th>\n",
" <th>census_tract</th>\n",
" <th>bin</th>\n",
" <th>bbl</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>1.931970e+05</td>\n",
" <td>193197.000000</td>\n",
" <td>193197.000000</td>\n",
" <td>193197.000000</td>\n",
" <td>193197.000000</td>\n",
" <td>193197.000000</td>\n",
" <td>1.931970e+05</td>\n",
" <td>1.931970e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>4.605010e+07</td>\n",
" <td>10677.212540</td>\n",
" <td>12.947680</td>\n",
" <td>248.602603</td>\n",
" <td>20.020715</td>\n",
" <td>28796.048298</td>\n",
" <td>2.513373e+06</td>\n",
" <td>2.450622e+09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>4.415232e+06</td>\n",
" <td>595.142246</td>\n",
" <td>8.180244</td>\n",
" <td>130.697014</td>\n",
" <td>15.809664</td>\n",
" <td>30672.683469</td>\n",
" <td>1.351134e+06</td>\n",
" <td>1.313578e+09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>3.011234e+07</td>\n",
" <td>10000.000000</td>\n",
" <td>-1.000000</td>\n",
" <td>101.000000</td>\n",
" <td>1.000000</td>\n",
" <td>100.000000</td>\n",
" <td>1.000000e+06</td>\n",
" <td>1.000000e+09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>4.138051e+07</td>\n",
" <td>10022.000000</td>\n",
" <td>9.000000</td>\n",
" <td>105.000000</td>\n",
" <td>4.000000</td>\n",
" <td>7895.605691</td>\n",
" <td>1.042708e+06</td>\n",
" <td>1.011024e+09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>5.000527e+07</td>\n",
" <td>10468.006114</td>\n",
" <td>12.000000</td>\n",
" <td>301.000000</td>\n",
" <td>19.747529</td>\n",
" <td>16022.917106</td>\n",
" <td>3.007191e+06</td>\n",
" <td>3.002924e+09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>5.005661e+07</td>\n",
" <td>11228.624535</td>\n",
" <td>13.000000</td>\n",
" <td>401.000000</td>\n",
" <td>34.000000</td>\n",
" <td>40246.000337</td>\n",
" <td>4.002294e+06</td>\n",
" <td>4.003343e+09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>5.010416e+07</td>\n",
" <td>12345.000000</td>\n",
" <td>99.000000</td>\n",
" <td>503.000000</td>\n",
" <td>51.000000</td>\n",
" <td>162100.000000</td>\n",
" <td>5.799501e+06</td>\n",
" <td>5.270001e+09</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" camis zipcode score community_board \\\n",
"count 1.931970e+05 193197.000000 193197.000000 193197.000000 \n",
"mean 4.605010e+07 10677.212540 12.947680 248.602603 \n",
"std 4.415232e+06 595.142246 8.180244 130.697014 \n",
"min 3.011234e+07 10000.000000 -1.000000 101.000000 \n",
"25% 4.138051e+07 10022.000000 9.000000 105.000000 \n",
"50% 5.000527e+07 10468.006114 12.000000 301.000000 \n",
"75% 5.005661e+07 11228.624535 13.000000 401.000000 \n",
"max 5.010416e+07 12345.000000 99.000000 503.000000 \n",
"\n",
" council_district census_tract bin bbl \n",
"count 193197.000000 193197.000000 1.931970e+05 1.931970e+05 \n",
"mean 20.020715 28796.048298 2.513373e+06 2.450622e+09 \n",
"std 15.809664 30672.683469 1.351134e+06 1.313578e+09 \n",
"min 1.000000 100.000000 1.000000e+06 1.000000e+09 \n",
"25% 4.000000 7895.605691 1.042708e+06 1.011024e+09 \n",
"50% 19.747529 16022.917106 3.007191e+06 3.002924e+09 \n",
"75% 34.000000 40246.000337 4.002294e+06 4.003343e+09 \n",
"max 51.000000 162100.000000 5.799501e+06 5.270001e+09 "
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Aggregating values\n",
"df.describe()"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmkAAAJOCAYAAADs2JBcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcm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+1zSU6uqqdMf58dWBfPl/V3qOfGlUnOnM7yPDnJI3OHRVeFTxxYBVX10szee3Pgo6suXOcpHXaq6ieT/O8kn8zfvP/p1zN7X9rlSb4vyWeTvHqMcfCbQnmCVdVCkn8zxnh5Vf1AZq+sPSPJLUn+xRjjG+s5v8NNVf3jzAPm+1AAAAB2SURBVE7mODLJXUlem9n/tHuurKOq+o9Jfjazs9VvSfLzmb3HyfNljVTVB5MsJHlWks8nuSDJ/8gSz40ppv9LZoelv5bktWOMm1Z1PiINAKAfhzsBABoSaQAADYk0AICGRBoAQEMiDQCgIZEGANCQSAMAaOj/A8jJNNoTQHk2AAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 720x720 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Plotting with matplotlib\n",
"from matplotlib import pyplot as plt\n",
"\n",
"df[[\"score\"]].hist(figsize=[10,10])\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>camis</th>\n",
" <th>dba</th>\n",
" <th>boro</th>\n",
" <th>building</th>\n",
" <th>street</th>\n",
" <th>zipcode</th>\n",
" <th>phone</th>\n",
" <th>cuisine_description</th>\n",
" <th>inspection_date</th>\n",
" <th>action</th>\n",
" <th>...</th>\n",
" <th>grade_date</th>\n",
" <th>record_date</th>\n",
" <th>inspection_type</th>\n",
" <th>community_board</th>\n",
" <th>council_district</th>\n",
" <th>census_tract</th>\n",
" <th>bin</th>\n",
" <th>bbl</th>\n",
" <th>nta</th>\n",
" <th>location</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>53127</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>12/26/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/26/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>61268</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>07/20/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>07/20/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20717</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>03/04/2020</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>03/04/2020</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4648</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>05/25/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/25/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>224</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>05/25/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/25/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9465</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>03/04/2020</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>03/04/2020</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>104512</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>12/19/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/19/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>106728</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>01/25/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/25/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62748</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>05/28/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/28/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>79211</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>11/05/2016</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>11/05/2016</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>218545</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>01/10/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/10/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>238663</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>11/05/2016</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>11/05/2016</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>245205</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>12/19/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/19/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>245233</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>01/25/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/25/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>247417</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>05/05/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/05/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>186874</th>\n",
" <td>50099704</td>\n",
" <td>MASTER'S PIZZERIA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>11/18/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>11/18/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Pre-permit (Operational) / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>198104</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>12/28/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/28/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>213425</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>12/19/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/19/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>202363</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>05/28/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/28/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>158059</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>12/19/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/19/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>163672</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>08/13/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>08/13/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>138508</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>01/29/2020</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/29/2020</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>140940</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>07/20/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>07/20/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>143157</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>01/10/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/10/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>149548</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>07/20/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>07/20/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>149742</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>05/31/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/31/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>249994</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>01/25/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/25/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>257603</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>08/13/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>08/13/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>268823</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>01/10/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/10/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>269521</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>12/17/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/17/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>277500</th>\n",
" <td>50099704</td>\n",
" <td>MASTER'S PIZZERIA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>11/18/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>11/18/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Pre-permit (Operational) / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>279503</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>01/29/2020</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/29/2020</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>299863</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>12/26/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/26/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>319787</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>05/25/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/25/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" <tr>\n",
" <th>336570</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>01/10/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/10/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>340551</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>04/10/2017</td>\n",
" <td>Establishment re-opened by DOHMH</td>\n",
" <td>...</td>\n",
" <td>04/10/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Reopening Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>395508</th>\n",
" <td>41144258</td>\n",
" <td>BURGER KING</td>\n",
" <td>Brooklyn</td>\n",
" <td>5212</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7187650844</td>\n",
" <td>Hamburgers</td>\n",
" <td>12/17/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/17/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>7600.0</td>\n",
" <td>3329902.0</td>\n",
" <td>3.008070e+09</td>\n",
" <td>BK32</td>\n",
" <td>40.643852716573,-74.011628212186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>309366</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>12/28/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/28/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>340857</th>\n",
" <td>40396492</td>\n",
" <td>ROYAL KING'S PIZZA</td>\n",
" <td>Brooklyn</td>\n",
" <td>5211</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184923846</td>\n",
" <td>Pizza</td>\n",
" <td>01/29/2020</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>01/29/2020</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013939.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643849974348996,-74.01160298782</td>\n",
" </tr>\n",
" <tr>\n",
" <th>358660</th>\n",
" <td>50004330</td>\n",
" <td>KFC</td>\n",
" <td>Brooklyn</td>\n",
" <td>5223</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184922813</td>\n",
" <td>Chicken</td>\n",
" <td>05/31/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/31/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013937.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643800563168,-74.01165342693001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>393451</th>\n",
" <td>41271801</td>\n",
" <td>PINO'S</td>\n",
" <td>Brooklyn</td>\n",
" <td>5201</td>\n",
" <td>5 AVENUE</td>\n",
" <td>11220.0</td>\n",
" <td>7184396012</td>\n",
" <td>Pizza</td>\n",
" <td>06/05/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>06/05/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>307.0</td>\n",
" <td>38.0</td>\n",
" <td>10000.0</td>\n",
" <td>3013942.0</td>\n",
" <td>3.008080e+09</td>\n",
" <td>BK34</td>\n",
" <td>40.643888405293005,-74.011563356969</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
"<p>41 rows × 25 columns</p>"
],
"text/plain": [
" camis dba boro building street zipcode \\\n",
"53127 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"61268 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"20717 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"4648 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"224 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"9465 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"104512 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"106728 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"62748 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"79211 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"218545 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"238663 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"245205 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"245233 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"247417 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"186874 50099704 MASTER'S PIZZERIA Brooklyn 5201 5 AVENUE 11220.0 \n",
"198104 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"213425 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"202363 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"158059 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"163672 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"138508 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"140940 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"143157 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"149548 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"149742 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"249994 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"257603 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"268823 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"269521 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"277500 50099704 MASTER'S PIZZERIA Brooklyn 5201 5 AVENUE 11220.0 \n",
"279503 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"299863 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"319787 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"336570 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"340551 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"395508 41144258 BURGER KING Brooklyn 5212 5 AVENUE 11220.0 \n",
"309366 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"340857 40396492 ROYAL KING'S PIZZA Brooklyn 5211 5 AVENUE 11220.0 \n",
"358660 50004330 KFC Brooklyn 5223 5 AVENUE 11220.0 \n",
"393451 41271801 PINO'S Brooklyn 5201 5 AVENUE 11220.0 \n",
"\n",
" phone cuisine_description inspection_date \\\n",
"53127 7187650844 Hamburgers 12/26/2018 \n",
"61268 7187650844 Hamburgers 07/20/2017 \n",
"20717 7187650844 Hamburgers 03/04/2020 \n",
"4648 7184396012 Pizza 05/25/2019 \n",
"224 7184396012 Pizza 05/25/2019 \n",
"9465 7187650844 Hamburgers 03/04/2020 \n",
"104512 7184923846 Pizza 12/19/2018 \n",
"106728 7184396012 Pizza 01/25/2018 \n",
"62748 7184922813 Chicken 05/28/2019 \n",
"79211 7184396012 Pizza 11/05/2016 \n",
"218545 7184922813 Chicken 01/10/2018 \n",
"238663 7184396012 Pizza 11/05/2016 \n",
"245205 7184923846 Pizza 12/19/2018 \n",
"245233 7184396012 Pizza 01/25/2018 \n",
"247417 7184922813 Chicken 05/05/2017 \n",
"186874 7184396012 Pizza 11/18/2019 \n",
"198104 7184923846 Pizza 12/28/2017 \n",
"213425 7184923846 Pizza 12/19/2018 \n",
"202363 7184922813 Chicken 05/28/2019 \n",
"158059 7184923846 Pizza 12/19/2018 \n",
"163672 7187650844 Hamburgers 08/13/2018 \n",
"138508 7184923846 Pizza 01/29/2020 \n",
"140940 7187650844 Hamburgers 07/20/2017 \n",
"143157 7184922813 Chicken 01/10/2018 \n",
"149548 7187650844 Hamburgers 07/20/2017 \n",
"149742 7184922813 Chicken 05/31/2018 \n",
"249994 7184396012 Pizza 01/25/2018 \n",
"257603 7187650844 Hamburgers 08/13/2018 \n",
"268823 7184922813 Chicken 01/10/2018 \n",
"269521 7187650844 Hamburgers 12/17/2019 \n",
"277500 7184396012 Pizza 11/18/2019 \n",
"279503 7184923846 Pizza 01/29/2020 \n",
"299863 7187650844 Hamburgers 12/26/2018 \n",
"319787 7184396012 Pizza 05/25/2019 \n",
"336570 7184922813 Chicken 01/10/2018 \n",
"340551 7184922813 Chicken 04/10/2017 \n",
"395508 7187650844 Hamburgers 12/17/2019 \n",
"309366 7184923846 Pizza 12/28/2017 \n",
"340857 7184923846 Pizza 01/29/2020 \n",
"358660 7184922813 Chicken 05/31/2018 \n",
"393451 7184396012 Pizza 06/05/2018 \n",
"\n",
" action ... grade_date \\\n",
"53127 Violations were cited in the following area(s). ... 12/26/2018 \n",
"61268 Violations were cited in the following area(s). ... 07/20/2017 \n",
"20717 Violations were cited in the following area(s). ... 03/04/2020 \n",
"4648 Violations were cited in the following area(s). ... 05/25/2019 \n",
"224 Violations were cited in the following area(s). ... 05/25/2019 \n",
"9465 Violations were cited in the following area(s). ... 03/04/2020 \n",
"104512 Violations were cited in the following area(s). ... 12/19/2018 \n",
"106728 Violations were cited in the following area(s). ... 01/25/2018 \n",
"62748 Violations were cited in the following area(s). ... 05/28/2019 \n",
"79211 Violations were cited in the following area(s). ... 11/05/2016 \n",
"218545 Violations were cited in the following area(s). ... 01/10/2018 \n",
"238663 Violations were cited in the following area(s). ... 11/05/2016 \n",
"245205 Violations were cited in the following area(s). ... 12/19/2018 \n",
"245233 Violations were cited in the following area(s). ... 01/25/2018 \n",
"247417 Violations were cited in the following area(s). ... 05/05/2017 \n",
"186874 Violations were cited in the following area(s). ... 11/18/2019 \n",
"198104 Violations were cited in the following area(s). ... 12/28/2017 \n",
"213425 Violations were cited in the following area(s). ... 12/19/2018 \n",
"202363 Violations were cited in the following area(s). ... 05/28/2019 \n",
"158059 Violations were cited in the following area(s). ... 12/19/2018 \n",
"163672 Violations were cited in the following area(s). ... 08/13/2018 \n",
"138508 Violations were cited in the following area(s). ... 01/29/2020 \n",
"140940 Violations were cited in the following area(s). ... 07/20/2017 \n",
"143157 Violations were cited in the following area(s). ... 01/10/2018 \n",
"149548 Violations were cited in the following area(s). ... 07/20/2017 \n",
"149742 Violations were cited in the following area(s). ... 05/31/2018 \n",
"249994 Violations were cited in the following area(s). ... 01/25/2018 \n",
"257603 Violations were cited in the following area(s). ... 08/13/2018 \n",
"268823 Violations were cited in the following area(s). ... 01/10/2018 \n",
"269521 Violations were cited in the following area(s). ... 12/17/2019 \n",
"277500 Violations were cited in the following area(s). ... 11/18/2019 \n",
"279503 Violations were cited in the following area(s). ... 01/29/2020 \n",
"299863 Violations were cited in the following area(s). ... 12/26/2018 \n",
"319787 Violations were cited in the following area(s). ... 05/25/2019 \n",
"336570 Violations were cited in the following area(s). ... 01/10/2018 \n",
"340551 Establishment re-opened by DOHMH ... 04/10/2017 \n",
"395508 Violations were cited in the following area(s). ... 12/17/2019 \n",
"309366 Violations were cited in the following area(s). ... 12/28/2017 \n",
"340857 Violations were cited in the following area(s). ... 01/29/2020 \n",
"358660 Violations were cited in the following area(s). ... 05/31/2018 \n",
"393451 Violations were cited in the following area(s). ... 06/05/2018 \n",
"\n",
" record_date inspection_type \\\n",
"53127 07/07/2020 Cycle Inspection / Initial Inspection \n",
"61268 07/07/2020 Cycle Inspection / Initial Inspection \n",
"20717 07/07/2020 Cycle Inspection / Initial Inspection \n",
"4648 07/07/2020 Cycle Inspection / Initial Inspection \n",
"224 07/07/2020 Cycle Inspection / Initial Inspection \n",
"9465 07/07/2020 Cycle Inspection / Initial Inspection \n",
"104512 07/07/2020 Cycle Inspection / Initial Inspection \n",
"106728 07/07/2020 Cycle Inspection / Re-inspection \n",
"62748 07/07/2020 Cycle Inspection / Initial Inspection \n",
"79211 07/07/2020 Cycle Inspection / Initial Inspection \n",
"218545 07/07/2020 Cycle Inspection / Re-inspection \n",
"238663 07/07/2020 Cycle Inspection / Initial Inspection \n",
"245205 07/07/2020 Cycle Inspection / Initial Inspection \n",
"245233 07/07/2020 Cycle Inspection / Re-inspection \n",
"247417 07/07/2020 Cycle Inspection / Re-inspection \n",
"186874 07/07/2020 Pre-permit (Operational) / Initial Inspection \n",
"198104 07/07/2020 Cycle Inspection / Initial Inspection \n",
"213425 07/07/2020 Cycle Inspection / Initial Inspection \n",
"202363 07/07/2020 Cycle Inspection / Initial Inspection \n",
"158059 07/07/2020 Cycle Inspection / Initial Inspection \n",
"163672 07/07/2020 Cycle Inspection / Re-inspection \n",
"138508 07/07/2020 Cycle Inspection / Re-inspection \n",
"140940 07/07/2020 Cycle Inspection / Initial Inspection \n",
"143157 07/07/2020 Cycle Inspection / Re-inspection \n",
"149548 07/07/2020 Cycle Inspection / Initial Inspection \n",
"149742 07/07/2020 Cycle Inspection / Initial Inspection \n",
"249994 07/07/2020 Cycle Inspection / Re-inspection \n",
"257603 07/07/2020 Cycle Inspection / Re-inspection \n",
"268823 07/07/2020 Cycle Inspection / Re-inspection \n",
"269521 07/07/2020 Cycle Inspection / Re-inspection \n",
"277500 07/07/2020 Pre-permit (Operational) / Initial Inspection \n",
"279503 07/07/2020 Cycle Inspection / Re-inspection \n",
"299863 07/07/2020 Cycle Inspection / Initial Inspection \n",
"319787 07/07/2020 Cycle Inspection / Initial Inspection \n",
"336570 07/07/2020 Cycle Inspection / Re-inspection \n",
"340551 07/07/2020 Cycle Inspection / Reopening Inspection \n",
"395508 07/07/2020 Cycle Inspection / Re-inspection \n",
"309366 07/07/2020 Cycle Inspection / Initial Inspection \n",
"340857 07/07/2020 Cycle Inspection / Re-inspection \n",
"358660 07/07/2020 Cycle Inspection / Initial Inspection \n",
"393451 07/07/2020 Cycle Inspection / Initial Inspection \n",
"\n",
" community_board council_district census_tract bin \\\n",
"53127 307.0 38.0 7600.0 3329902.0 \n",
"61268 307.0 38.0 7600.0 3329902.0 \n",
"20717 307.0 38.0 7600.0 3329902.0 \n",
"4648 307.0 38.0 10000.0 3013942.0 \n",
"224 307.0 38.0 10000.0 3013942.0 \n",
"9465 307.0 38.0 7600.0 3329902.0 \n",
"104512 307.0 38.0 10000.0 3013939.0 \n",
"106728 307.0 38.0 10000.0 3013942.0 \n",
"62748 307.0 38.0 10000.0 3013937.0 \n",
"79211 307.0 38.0 10000.0 3013942.0 \n",
"218545 307.0 38.0 10000.0 3013937.0 \n",
"238663 307.0 38.0 10000.0 3013942.0 \n",
"245205 307.0 38.0 10000.0 3013939.0 \n",
"245233 307.0 38.0 10000.0 3013942.0 \n",
"247417 307.0 38.0 10000.0 3013937.0 \n",
"186874 307.0 38.0 10000.0 3013942.0 \n",
"198104 307.0 38.0 10000.0 3013939.0 \n",
"213425 307.0 38.0 10000.0 3013939.0 \n",
"202363 307.0 38.0 10000.0 3013937.0 \n",
"158059 307.0 38.0 10000.0 3013939.0 \n",
"163672 307.0 38.0 7600.0 3329902.0 \n",
"138508 307.0 38.0 10000.0 3013939.0 \n",
"140940 307.0 38.0 7600.0 3329902.0 \n",
"143157 307.0 38.0 10000.0 3013937.0 \n",
"149548 307.0 38.0 7600.0 3329902.0 \n",
"149742 307.0 38.0 10000.0 3013937.0 \n",
"249994 307.0 38.0 10000.0 3013942.0 \n",
"257603 307.0 38.0 7600.0 3329902.0 \n",
"268823 307.0 38.0 10000.0 3013937.0 \n",
"269521 307.0 38.0 7600.0 3329902.0 \n",
"277500 307.0 38.0 10000.0 3013942.0 \n",
"279503 307.0 38.0 10000.0 3013939.0 \n",
"299863 307.0 38.0 7600.0 3329902.0 \n",
"319787 307.0 38.0 10000.0 3013942.0 \n",
"336570 307.0 38.0 10000.0 3013937.0 \n",
"340551 307.0 38.0 10000.0 3013937.0 \n",
"395508 307.0 38.0 7600.0 3329902.0 \n",
"309366 307.0 38.0 10000.0 3013939.0 \n",
"340857 307.0 38.0 10000.0 3013939.0 \n",
"358660 307.0 38.0 10000.0 3013937.0 \n",
"393451 307.0 38.0 10000.0 3013942.0 \n",
"\n",
" bbl nta location \n",
"53127 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"61268 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"20717 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"4648 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"224 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"9465 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"104512 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"106728 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"62748 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"79211 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"218545 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"238663 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"245205 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"245233 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"247417 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"186874 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"198104 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"213425 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"202363 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"158059 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"163672 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"138508 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"140940 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"143157 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"149548 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"149742 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"249994 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"257603 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"268823 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"269521 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"277500 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"279503 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"299863 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"319787 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"336570 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"340551 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"395508 3.008070e+09 BK32 40.643852716573,-74.011628212186 \n",
"309366 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"340857 3.008080e+09 BK34 40.643849974348996,-74.01160298782 \n",
"358660 3.008080e+09 BK34 40.643800563168,-74.01165342693001 \n",
"393451 3.008080e+09 BK34 40.643888405293005,-74.011563356969 \n",
"\n",
"[41 rows x 25 columns]"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# es_query() allows for the full Elasticsearch querying capabilities\n",
"df.es_query({\n",
" \"geo_distance\": {\n",
" \"distance\": \"50m\",\n",
" \"location\": {\n",
" \"lat\": 40.643852716573,\n",
" \"lon\": -74.011628212186\n",
" }\n",
" }\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>camis</th>\n",
" <th>dba</th>\n",
" <th>boro</th>\n",
" <th>building</th>\n",
" <th>street</th>\n",
" <th>zipcode</th>\n",
" <th>phone</th>\n",
" <th>cuisine_description</th>\n",
" <th>inspection_date</th>\n",
" <th>action</th>\n",
" <th>...</th>\n",
" <th>grade_date</th>\n",
" <th>record_date</th>\n",
" <th>inspection_type</th>\n",
" <th>community_board</th>\n",
" <th>council_district</th>\n",
" <th>census_tract</th>\n",
" <th>bin</th>\n",
" <th>bbl</th>\n",
" <th>nta</th>\n",
" <th>location</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>5765</th>\n",
" <td>50033781</td>\n",
" <td>RED HOOK LOBSTER POUND</td>\n",
" <td>Brooklyn</td>\n",
" <td>284</td>\n",
" <td>VAN BRUNT STREET</td>\n",
" <td>11231.0</td>\n",
" <td>7188587650</td>\n",
" <td>Seafood</td>\n",
" <td>04/19/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>04/19/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>306.0</td>\n",
" <td>38.0</td>\n",
" <td>5900.0</td>\n",
" <td>3008365.0</td>\n",
" <td>3.005290e+09</td>\n",
" <td>BK33</td>\n",
" <td>40.67974632809,-74.010098611838</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12379</th>\n",
" <td>50058053</td>\n",
" <td>RED HOT II</td>\n",
" <td>Brooklyn</td>\n",
" <td>349</td>\n",
" <td>7 AVENUE</td>\n",
" <td>11215.0</td>\n",
" <td>7183692577</td>\n",
" <td>Chinese</td>\n",
" <td>05/17/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/17/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>306.0</td>\n",
" <td>39.0</td>\n",
" <td>15100.0</td>\n",
" <td>3026127.0</td>\n",
" <td>3.010940e+09</td>\n",
" <td>BK37</td>\n",
" <td>40.666194419994,-73.98214269199799</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12978</th>\n",
" <td>50059700</td>\n",
" <td>RED POKE</td>\n",
" <td>Manhattan</td>\n",
" <td>600</td>\n",
" <td>9 AVENUE</td>\n",
" <td>10036.0</td>\n",
" <td>2129748100</td>\n",
" <td>Hawaiian</td>\n",
" <td>03/21/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>03/21/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Pre-permit (Operational) / Re-inspection</td>\n",
" <td>104.0</td>\n",
" <td>3.0</td>\n",
" <td>12100.0</td>\n",
" <td>1088997.0</td>\n",
" <td>1.010330e+09</td>\n",
" <td>MN15</td>\n",
" <td>40.758993434643,-73.992203122611</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16759</th>\n",
" <td>40365239</td>\n",
" <td>DORRIAN'S RED HAND RESTAURANT</td>\n",
" <td>Manhattan</td>\n",
" <td>1616</td>\n",
" <td>2 AVENUE</td>\n",
" <td>10028.0</td>\n",
" <td>2127726660</td>\n",
" <td>Irish</td>\n",
" <td>11/08/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>11/08/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>108.0</td>\n",
" <td>5.0</td>\n",
" <td>13800.0</td>\n",
" <td>1049947.0</td>\n",
" <td>1.015460e+09</td>\n",
" <td>MN32</td>\n",
" <td>40.776404966262,-73.952802065662</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18624</th>\n",
" <td>50095340</td>\n",
" <td>RED PEONY CHINESE CUISINE</td>\n",
" <td>Manhattan</td>\n",
" <td>24</td>\n",
" <td>WEST 56 STREET</td>\n",
" <td>10019.0</td>\n",
" <td>2123808883</td>\n",
" <td>Chinese</td>\n",
" <td>11/21/2019</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>11/21/2019</td>\n",
" <td>07/07/2020</td>\n",
" <td>Pre-permit (Operational) / Re-inspection</td>\n",
" <td>105.0</td>\n",
" <td>4.0</td>\n",
" <td>10400.0</td>\n",
" <td>1034840.0</td>\n",
" <td>1.012710e+09</td>\n",
" <td>MN17</td>\n",
" <td>40.762699245064,-73.975463733228</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>391229</th>\n",
" <td>50061162</td>\n",
" <td>CODE RED</td>\n",
" <td>Bronx</td>\n",
" <td>1320</td>\n",
" <td>EAST GUN HILL ROAD</td>\n",
" <td>10469.0</td>\n",
" <td>7188811808</td>\n",
" <td>Caribbean</td>\n",
" <td>05/14/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>05/14/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>211.0</td>\n",
" <td>12.0</td>\n",
" <td>35000.0</td>\n",
" <td>2056100.0</td>\n",
" <td>2.045890e+09</td>\n",
" <td>BX31</td>\n",
" <td>40.871378316318996,-73.848028279305</td>\n",
" </tr>\n",
" <tr>\n",
" <th>393531</th>\n",
" <td>50014078</td>\n",
" <td>RED LOBSTER</td>\n",
" <td>Manhattan</td>\n",
" <td>5</td>\n",
" <td>TIMES SQ</td>\n",
" <td>10036.0</td>\n",
" <td>2127306706</td>\n",
" <td>Seafood</td>\n",
" <td>11/08/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>11/08/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>105.0</td>\n",
" <td>3.0</td>\n",
" <td>11300.0</td>\n",
" <td>1024656.0</td>\n",
" <td>1.010130e+09</td>\n",
" <td>MN17</td>\n",
" <td>40.755702020307005,-73.987207980138</td>\n",
" </tr>\n",
" <tr>\n",
" <th>396171</th>\n",
" <td>40368313</td>\n",
" <td>RED FLAME DINER</td>\n",
" <td>Manhattan</td>\n",
" <td>67</td>\n",
" <td>WEST 44 STREET</td>\n",
" <td>10036.0</td>\n",
" <td>2128693965</td>\n",
" <td>American</td>\n",
" <td>02/16/2018</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>02/16/2018</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Initial Inspection</td>\n",
" <td>105.0</td>\n",
" <td>4.0</td>\n",
" <td>9600.0</td>\n",
" <td>1034217.0</td>\n",
" <td>1.012600e+09</td>\n",
" <td>MN17</td>\n",
" <td>40.755627203336,-73.981938150269</td>\n",
" </tr>\n",
" <tr>\n",
" <th>396501</th>\n",
" <td>50068499</td>\n",
" <td>RED GINGER</td>\n",
" <td>Staten Island</td>\n",
" <td>1650</td>\n",
" <td>RICHMOND AVENUE</td>\n",
" <td>10314.0</td>\n",
" <td>7189828808</td>\n",
" <td>Other</td>\n",
" <td>09/19/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>09/19/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Pre-permit (Operational) / Initial Inspection</td>\n",
" <td>502.0</td>\n",
" <td>50.0</td>\n",
" <td>29103.0</td>\n",
" <td>5037014.0</td>\n",
" <td>5.022360e+09</td>\n",
" <td>SI05</td>\n",
" <td>40.608078102502,-74.162260908042</td>\n",
" </tr>\n",
" <tr>\n",
" <th>398950</th>\n",
" <td>50059700</td>\n",
" <td>RED POKE</td>\n",
" <td>Manhattan</td>\n",
" <td>600</td>\n",
" <td>9 AVENUE</td>\n",
" <td>10036.0</td>\n",
" <td>2129748100</td>\n",
" <td>Hawaiian</td>\n",
" <td>12/08/2017</td>\n",
" <td>Violations were cited in the following area(s).</td>\n",
" <td>...</td>\n",
" <td>12/08/2017</td>\n",
" <td>07/07/2020</td>\n",
" <td>Cycle Inspection / Re-inspection</td>\n",
" <td>104.0</td>\n",
" <td>3.0</td>\n",
" <td>12100.0</td>\n",
" <td>1088997.0</td>\n",
" <td>1.010330e+09</td>\n",
" <td>MN15</td>\n",
" <td>40.758993434643,-73.992203122611</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
"<p>573 rows × 25 columns</p>"
],
"text/plain": [
" camis dba boro building \\\n",
"5765 50033781 RED HOOK LOBSTER POUND Brooklyn 284 \n",
"12379 50058053 RED HOT II Brooklyn 349 \n",
"12978 50059700 RED POKE Manhattan 600 \n",
"16759 40365239 DORRIAN'S RED HAND RESTAURANT Manhattan 1616 \n",
"18624 50095340 RED PEONY CHINESE CUISINE Manhattan 24 \n",
"... ... ... ... ... \n",
"391229 50061162 CODE RED Bronx 1320 \n",
"393531 50014078 RED LOBSTER Manhattan 5 \n",
"396171 40368313 RED FLAME DINER Manhattan 67 \n",
"396501 50068499 RED GINGER Staten Island 1650 \n",
"398950 50059700 RED POKE Manhattan 600 \n",
"\n",
" street zipcode phone cuisine_description \\\n",
"5765 VAN BRUNT STREET 11231.0 7188587650 Seafood \n",
"12379 7 AVENUE 11215.0 7183692577 Chinese \n",
"12978 9 AVENUE 10036.0 2129748100 Hawaiian \n",
"16759 2 AVENUE 10028.0 2127726660 Irish \n",
"18624 WEST 56 STREET 10019.0 2123808883 Chinese \n",
"... ... ... ... ... \n",
"391229 EAST GUN HILL ROAD 10469.0 7188811808 Caribbean \n",
"393531 TIMES SQ 10036.0 2127306706 Seafood \n",
"396171 WEST 44 STREET 10036.0 2128693965 American \n",
"396501 RICHMOND AVENUE 10314.0 7189828808 Other \n",
"398950 9 AVENUE 10036.0 2129748100 Hawaiian \n",
"\n",
" inspection_date action ... \\\n",
"5765 04/19/2018 Violations were cited in the following area(s). ... \n",
"12379 05/17/2018 Violations were cited in the following area(s). ... \n",
"12978 03/21/2017 Violations were cited in the following area(s). ... \n",
"16759 11/08/2018 Violations were cited in the following area(s). ... \n",
"18624 11/21/2019 Violations were cited in the following area(s). ... \n",
"... ... ... ... \n",
"391229 05/14/2018 Violations were cited in the following area(s). ... \n",
"393531 11/08/2017 Violations were cited in the following area(s). ... \n",
"396171 02/16/2018 Violations were cited in the following area(s). ... \n",
"396501 09/19/2017 Violations were cited in the following area(s). ... \n",
"398950 12/08/2017 Violations were cited in the following area(s). ... \n",
"\n",
" grade_date record_date inspection_type \\\n",
"5765 04/19/2018 07/07/2020 Cycle Inspection / Initial Inspection \n",
"12379 05/17/2018 07/07/2020 Cycle Inspection / Re-inspection \n",
"12978 03/21/2017 07/07/2020 Pre-permit (Operational) / Re-inspection \n",
"16759 11/08/2018 07/07/2020 Cycle Inspection / Initial Inspection \n",
"18624 11/21/2019 07/07/2020 Pre-permit (Operational) / Re-inspection \n",
"... ... ... ... \n",
"391229 05/14/2018 07/07/2020 Cycle Inspection / Initial Inspection \n",
"393531 11/08/2017 07/07/2020 Cycle Inspection / Re-inspection \n",
"396171 02/16/2018 07/07/2020 Cycle Inspection / Initial Inspection \n",
"396501 09/19/2017 07/07/2020 Pre-permit (Operational) / Initial Inspection \n",
"398950 12/08/2017 07/07/2020 Cycle Inspection / Re-inspection \n",
"\n",
" community_board council_district census_tract bin \\\n",
"5765 306.0 38.0 5900.0 3008365.0 \n",
"12379 306.0 39.0 15100.0 3026127.0 \n",
"12978 104.0 3.0 12100.0 1088997.0 \n",
"16759 108.0 5.0 13800.0 1049947.0 \n",
"18624 105.0 4.0 10400.0 1034840.0 \n",
"... ... ... ... ... \n",
"391229 211.0 12.0 35000.0 2056100.0 \n",
"393531 105.0 3.0 11300.0 1024656.0 \n",
"396171 105.0 4.0 9600.0 1034217.0 \n",
"396501 502.0 50.0 29103.0 5037014.0 \n",
"398950 104.0 3.0 12100.0 1088997.0 \n",
"\n",
" bbl nta location \n",
"5765 3.005290e+09 BK33 40.67974632809,-74.010098611838 \n",
"12379 3.010940e+09 BK37 40.666194419994,-73.98214269199799 \n",
"12978 1.010330e+09 MN15 40.758993434643,-73.992203122611 \n",
"16759 1.015460e+09 MN32 40.776404966262,-73.952802065662 \n",
"18624 1.012710e+09 MN17 40.762699245064,-73.975463733228 \n",
"... ... ... ... \n",
"391229 2.045890e+09 BX31 40.871378316318996,-73.848028279305 \n",
"393531 1.010130e+09 MN17 40.755702020307005,-73.987207980138 \n",
"396171 1.012600e+09 MN17 40.755627203336,-73.981938150269 \n",
"396501 5.022360e+09 SI05 40.608078102502,-74.162260908042 \n",
"398950 1.010330e+09 MN15 40.758993434643,-73.992203122611 \n",
"\n",
"[573 rows x 25 columns]"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Full-text search example\n",
"df.es_query({\"match\": {\"dba\": \"red\"}})"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 100 entries, 107677 to 96813\n",
"Data columns (total 25 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 camis 100 non-null int64 \n",
" 1 dba 100 non-null object \n",
" 2 boro 100 non-null object \n",
" 3 building 100 non-null object \n",
" 4 street 100 non-null object \n",
" 5 zipcode 100 non-null float64\n",
" 6 phone 100 non-null object \n",
" 7 cuisine_description 100 non-null object \n",
" 8 inspection_date 100 non-null object \n",
" 9 action 100 non-null object \n",
" 10 violation_code 100 non-null object \n",
" 11 violation_description 100 non-null object \n",
" 12 critical_flag 100 non-null object \n",
" 13 score 100 non-null float64\n",
" 14 grade 100 non-null object \n",
" 15 grade_date 100 non-null object \n",
" 16 record_date 100 non-null object \n",
" 17 inspection_type 100 non-null object \n",
" 18 community_board 100 non-null float64\n",
" 19 council_district 100 non-null float64\n",
" 20 census_tract 100 non-null float64\n",
" 21 bin 100 non-null float64\n",
" 22 bbl 100 non-null float64\n",
" 23 nta 100 non-null object \n",
" 24 location 100 non-null object \n",
"dtypes: float64(7), int64(1), object(17)\n",
"memory usage: 20.3+ KB\n",
"<class 'pandas.core.frame.DataFrame'>\n"
]
}
],
"source": [
"# Pull a subset of your data for building graphs / operations locally.\n",
"sample_df = df[df.grade == \"B\"].sample(100).to_pandas()\n",
"sample_df.info()\n",
"print(type(sample_df))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Machine Learning Demo"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Feature Names: ['alcohol', 'malic_acid', 'ash', 'alcalinity_of_ash', 'magnesium', 'total_phenols', 'flavanoids', 'nonflavanoid_phenols', 'proanthocyanins', 'color_intensity', 'hue', 'od280/od315_of_diluted_wines', 'proline']\n",
"Data example: [1.423e+01 1.710e+00 2.430e+00 1.560e+01 1.270e+02 2.800e+00 3.060e+00\n",
" 2.800e-01 2.290e+00 5.640e+00 1.040e+00 3.920e+00 1.065e+03]\n",
"[0 1 2]\n",
"[0 1 2]\n"
]
}
],
"source": [
"# Import scikit-learn and train a dataset locally\n",
"from sklearn import datasets\n",
"from sklearn.tree import DecisionTreeClassifier\n",
"\n",
"# Train the data locally\n",
"digits = datasets.load_wine()\n",
"print(\"Feature Names:\", digits.feature_names)\n",
"print(\"Data example:\", digits.data[0])\n",
"\n",
"# Save 10, 80, and 140 for testing our model\n",
"data = [x for i, x in enumerate(digits.data) if i not in (10, 80, 140)]\n",
"target = [x for i, x in enumerate(digits.target) if i not in (10, 80, 140)]\n",
"\n",
"sk_classifier = DecisionTreeClassifier()\n",
"sk_classifier.fit(data, target)\n",
"\n",
"# Test out our model against the three targets\n",
"print(sk_classifier.predict(digits.data[[10, 80, 140]]))\n",
"print(digits.target[[10, 80, 140]])"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"POST https://167e473c7bba4bae85004385d4e0ce46.us-central1.gcp.cloud.es.io/_ingest/pipeline/_simulate [status:200 request:0.053s]\n",
"> {\"pipeline\":{\"processors\":[{\"inference\":{\"model_id\":\"wine-classifier\",\"inference_config\":{\"classification\":{}},\"field_map\":{}}}]},\"docs\":[{\"_source\":{\"alcohol\":14.1,\"malic_acid\":2.16,\"ash\":2.3,\"alcalinity_of_ash\":18.0,\"magnesium\":105.0,\"total_phenols\":2.95,\"flavanoids\":3.32,\"nonflavanoid_phenols\":0.22,\"proanthocyanins\":2.38,\"color_intensity\":5.75,\"hue\":1.25,\"od280/od315_of_diluted_wines\":3.17,\"proline\":1510.0}},{\"_source\":{\"alcohol\":12.0,\"malic_acid\":0.92,\"ash\":2.0,\"alcalinity_of_ash\":19.0,\"magnesium\":86.0,\"total_phenols\":2.42,\"flavanoids\":2.26,\"nonflavanoid_phenols\":0.3,\"proanthocyanins\":1.43,\"color_intensity\":2.5,\"hue\":1.38,\"od280/od315_of_diluted_wines\":3.12,\"proline\":278.0}},{\"_source\":{\"alcohol\":12.93,\"malic_acid\":2.81,\"ash\":2.7,\"alcalinity_of_ash\":21.0,\"magnesium\":96.0,\"total_phenols\":1.54,\"flavanoids\":0.5,\"nonflavanoid_phenols\":0.53,\"proanthocyanins\":0.75,\"color_intensity\":4.6,\"hue\":0.77,\"od280/od315_of_diluted_wines\":2.31,\"proline\":600.0}}]}\n",
"< {\"docs\":[{\"doc\":{\"_index\":\"_index\",\"_type\":\"_doc\",\"_id\":\"_id\",\"_source\":{\"alcohol\":14.1,\"alcalinity_of_ash\":18.0,\"proanthocyanins\":2.38,\"od280/od315_of_diluted_wines\":3.17,\"total_phenols\":2.95,\"magnesium\":105.0,\"flavanoids\":3.32,\"proline\":1510.0,\"malic_acid\":2.16,\"ash\":2.3,\"nonflavanoid_phenols\":0.22,\"hue\":1.25,\"color_intensity\":5.75,\"ml\":{\"inference\":{\"predicted_value\":\"0\",\"model_id\":\"wine-classifier\"}}},\"_ingest\":{\"timestamp\":\"2020-07-08T15:35:49.98965Z\"}}},{\"doc\":{\"_index\":\"_index\",\"_type\":\"_doc\",\"_id\":\"_id\",\"_source\":{\"alcohol\":12.0,\"alcalinity_of_ash\":19.0,\"proanthocyanins\":1.43,\"od280/od315_of_diluted_wines\":3.12,\"total_phenols\":2.42,\"magnesium\":86.0,\"flavanoids\":2.26,\"proline\":278.0,\"malic_acid\":0.92,\"ash\":2.0,\"nonflavanoid_phenols\":0.3,\"hue\":1.38,\"color_intensity\":2.5,\"ml\":{\"inference\":{\"predicted_value\":\"1\",\"model_id\":\"wine-classifier\"}}},\"_ingest\":{\"timestamp\":\"2020-07-08T15:35:49.98966Z\"}}},{\"doc\":{\"_index\":\"_index\",\"_type\":\"_doc\",\"_id\":\"_id\",\"_source\":{\"alcohol\":12.93,\"alcalinity_of_ash\":21.0,\"proanthocyanins\":0.75,\"od280/od315_of_diluted_wines\":2.31,\"total_phenols\":1.54,\"magnesium\":96.0,\"flavanoids\":0.5,\"proline\":600.0,\"malic_acid\":2.81,\"ash\":2.7,\"nonflavanoid_phenols\":0.53,\"hue\":0.77,\"color_intensity\":4.6,\"ml\":{\"inference\":{\"predicted_value\":\"2\",\"model_id\":\"wine-classifier\"}}},\"_ingest\":{\"timestamp\":\"2020-07-08T15:35:49.989672Z\"}}}]}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0 1 2]\n",
"[0 1 2]\n"
]
}
],
"source": [
"from eland.ml import MLModel\n",
"\n",
"# Serialize the scikit-learn model into Elasticsearch\n",
"ed_classifier = MLModel.import_model(\n",
" es_client=es,\n",
" model_id=\"wine-classifier\",\n",
" model=sk_classifier,\n",
" feature_names=digits.feature_names,\n",
" overwrite=True\n",
")\n",
"\n",
"# Capture the Elasticsearch API call w/ logging\n",
"import logging\n",
"logger = logging.getLogger(\"elasticsearch\")\n",
"logger.setLevel(logging.DEBUG)\n",
"logger.addHandler(logging.StreamHandler())\n",
"\n",
"# Use the same data as before, but now with the model in Elasticsearch\n",
"print(ed_classifier.predict(digits.data[[10, 80, 140]].tolist()))\n",
"print(digits.target[[10, 80, 140]])\n",
"\n",
"logger.handlers = []"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"docs\": [\n",
" {\n",
" \"_source\": {\n",
" \"alcalinity_of_ash\": 18.0,\n",
" \"alcohol\": 14.1,\n",
" \"ash\": 2.3,\n",
" \"color_intensity\": 5.75,\n",
" \"flavanoids\": 3.32,\n",
" \"hue\": 1.25,\n",
" \"magnesium\": 105.0,\n",
" \"malic_acid\": 2.16,\n",
" \"nonflavanoid_phenols\": 0.22,\n",
" \"od280/od315_of_diluted_wines\": 3.17,\n",
" \"proanthocyanins\": 2.38,\n",
" \"proline\": 1510.0,\n",
" \"total_phenols\": 2.95\n",
" }\n",
" },\n",
" {\n",
" \"_source\": {\n",
" \"alcalinity_of_ash\": 19.0,\n",
" \"alcohol\": 12.0,\n",
" \"ash\": 2.0,\n",
" \"color_intensity\": 2.5,\n",
" \"flavanoids\": 2.26,\n",
" \"hue\": 1.38,\n",
" \"magnesium\": 86.0,\n",
" \"malic_acid\": 0.92,\n",
" \"nonflavanoid_phenols\": 0.3,\n",
" \"od280/od315_of_diluted_wines\": 3.12,\n",
" \"proanthocyanins\": 1.43,\n",
" \"proline\": 278.0,\n",
" \"total_phenols\": 2.42\n",
" }\n",
" },\n",
" {\n",
" \"_source\": {\n",
" \"alcalinity_of_ash\": 21.0,\n",
" \"alcohol\": 12.93,\n",
" \"ash\": 2.7,\n",
" \"color_intensity\": 4.6,\n",
" \"flavanoids\": 0.5,\n",
" \"hue\": 0.77,\n",
" \"magnesium\": 96.0,\n",
" \"malic_acid\": 2.81,\n",
" \"nonflavanoid_phenols\": 0.53,\n",
" \"od280/od315_of_diluted_wines\": 2.31,\n",
" \"proanthocyanins\": 0.75,\n",
" \"proline\": 600.0,\n",
" \"total_phenols\": 1.54\n",
" }\n",
" }\n",
" ],\n",
" \"pipeline\": {\n",
" \"processors\": [\n",
" {\n",
" \"inference\": {\n",
" \"field_map\": {},\n",
" \"inference_config\": {\n",
" \"classification\": {}\n",
" },\n",
" \"model_id\": \"wine-classifier\"\n",
" }\n",
" }\n",
" ]\n",
" }\n",
"}\n"
]
}
],
"source": [
"json({\"pipeline\":{\"processors\":[{\"inference\":{\"model_id\":\"wine-classifier\",\"inference_config\":{\"classification\":{}},\"field_map\":{}}}]},\"docs\":[{\"_source\":{\"alcohol\":14.1,\"malic_acid\":2.16,\"ash\":2.3,\"alcalinity_of_ash\":18.0,\"magnesium\":105.0,\"total_phenols\":2.95,\"flavanoids\":3.32,\"nonflavanoid_phenols\":0.22,\"proanthocyanins\":2.38,\"color_intensity\":5.75,\"hue\":1.25,\"od280/od315_of_diluted_wines\":3.17,\"proline\":1510.0}},{\"_source\":{\"alcohol\":12.0,\"malic_acid\":0.92,\"ash\":2.0,\"alcalinity_of_ash\":19.0,\"magnesium\":86.0,\"total_phenols\":2.42,\"flavanoids\":2.26,\"nonflavanoid_phenols\":0.3,\"proanthocyanins\":1.43,\"color_intensity\":2.5,\"hue\":1.38,\"od280/od315_of_diluted_wines\":3.12,\"proline\":278.0}},{\"_source\":{\"alcohol\":12.93,\"malic_acid\":2.81,\"ash\":2.7,\"alcalinity_of_ash\":21.0,\"magnesium\":96.0,\"total_phenols\":1.54,\"flavanoids\":0.5,\"nonflavanoid_phenols\":0.53,\"proanthocyanins\":0.75,\"color_intensity\":4.6,\"hue\":0.77,\"od280/od315_of_diluted_wines\":2.31,\"proline\":600.0}}]})"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"docs\": [\n",
" {\n",
" \"doc\": {\n",
" \"_id\": \"_id\",\n",
" \"_index\": \"_index\",\n",
" \"_ingest\": {\n",
" \"timestamp\": \"2020-07-08T15:35:49.98965Z\"\n",
" },\n",
" \"_source\": {\n",
" \"alcalinity_of_ash\": 18.0,\n",
" \"alcohol\": 14.1,\n",
" \"ash\": 2.3,\n",
" \"color_intensity\": 5.75,\n",
" \"flavanoids\": 3.32,\n",
" \"hue\": 1.25,\n",
" \"magnesium\": 105.0,\n",
" \"malic_acid\": 2.16,\n",
" \"ml\": {\n",
" \"inference\": {\n",
" \"model_id\": \"wine-classifier\",\n",
" \"predicted_value\": \"0\"\n",
" }\n",
" },\n",
" \"nonflavanoid_phenols\": 0.22,\n",
" \"od280/od315_of_diluted_wines\": 3.17,\n",
" \"proanthocyanins\": 2.38,\n",
" \"proline\": 1510.0,\n",
" \"total_phenols\": 2.95\n",
" },\n",
" \"_type\": \"_doc\"\n",
" }\n",
" },\n",
" {\n",
" \"doc\": {\n",
" \"_id\": \"_id\",\n",
" \"_index\": \"_index\",\n",
" \"_ingest\": {\n",
" \"timestamp\": \"2020-07-08T15:35:49.98966Z\"\n",
" },\n",
" \"_source\": {\n",
" \"alcalinity_of_ash\": 19.0,\n",
" \"alcohol\": 12.0,\n",
" \"ash\": 2.0,\n",
" \"color_intensity\": 2.5,\n",
" \"flavanoids\": 2.26,\n",
" \"hue\": 1.38,\n",
" \"magnesium\": 86.0,\n",
" \"malic_acid\": 0.92,\n",
" \"ml\": {\n",
" \"inference\": {\n",
" \"model_id\": \"wine-classifier\",\n",
" \"predicted_value\": \"1\"\n",
" }\n",
" },\n",
" \"nonflavanoid_phenols\": 0.3,\n",
" \"od280/od315_of_diluted_wines\": 3.12,\n",
" \"proanthocyanins\": 1.43,\n",
" \"proline\": 278.0,\n",
" \"total_phenols\": 2.42\n",
" },\n",
" \"_type\": \"_doc\"\n",
" }\n",
" },\n",
" {\n",
" \"doc\": {\n",
" \"_id\": \"_id\",\n",
" \"_index\": \"_index\",\n",
" \"_ingest\": {\n",
" \"timestamp\": \"2020-07-08T15:35:49.989672Z\"\n",
" },\n",
" \"_source\": {\n",
" \"alcalinity_of_ash\": 21.0,\n",
" \"alcohol\": 12.93,\n",
" \"ash\": 2.7,\n",
" \"color_intensity\": 4.6,\n",
" \"flavanoids\": 0.5,\n",
" \"hue\": 0.77,\n",
" \"magnesium\": 96.0,\n",
" \"malic_acid\": 2.81,\n",
" \"ml\": {\n",
" \"inference\": {\n",
" \"model_id\": \"wine-classifier\",\n",
" \"predicted_value\": \"2\"\n",
" }\n",
" },\n",
" \"nonflavanoid_phenols\": 0.53,\n",
" \"od280/od315_of_diluted_wines\": 2.31,\n",
" \"proanthocyanins\": 0.75,\n",
" \"proline\": 600.0,\n",
" \"total_phenols\": 1.54\n",
" },\n",
" \"_type\": \"_doc\"\n",
" }\n",
" }\n",
" ]\n",
"}\n"
]
}
],
"source": [
"json({\"docs\":[{\"doc\":{\"_index\":\"_index\",\"_type\":\"_doc\",\"_id\":\"_id\",\"_source\":{\"alcohol\":14.1,\"alcalinity_of_ash\":18.0,\"proanthocyanins\":2.38,\"od280/od315_of_diluted_wines\":3.17,\"total_phenols\":2.95,\"magnesium\":105.0,\"flavanoids\":3.32,\"proline\":1510.0,\"malic_acid\":2.16,\"ash\":2.3,\"nonflavanoid_phenols\":0.22,\"hue\":1.25,\"color_intensity\":5.75,\"ml\":{\"inference\":{\"predicted_value\":\"0\",\"model_id\":\"wine-classifier\"}}},\"_ingest\":{\"timestamp\":\"2020-07-08T15:35:49.98965Z\"}}},{\"doc\":{\"_index\":\"_index\",\"_type\":\"_doc\",\"_id\":\"_id\",\"_source\":{\"alcohol\":12.0,\"alcalinity_of_ash\":19.0,\"proanthocyanins\":1.43,\"od280/od315_of_diluted_wines\":3.12,\"total_phenols\":2.42,\"magnesium\":86.0,\"flavanoids\":2.26,\"proline\":278.0,\"malic_acid\":0.92,\"ash\":2.0,\"nonflavanoid_phenols\":0.3,\"hue\":1.38,\"color_intensity\":2.5,\"ml\":{\"inference\":{\"predicted_value\":\"1\",\"model_id\":\"wine-classifier\"}}},\"_ingest\":{\"timestamp\":\"2020-07-08T15:35:49.98966Z\"}}},{\"doc\":{\"_index\":\"_index\",\"_type\":\"_doc\",\"_id\":\"_id\",\"_source\":{\"alcohol\":12.93,\"alcalinity_of_ash\":21.0,\"proanthocyanins\":0.75,\"od280/od315_of_diluted_wines\":2.31,\"total_phenols\":1.54,\"magnesium\":96.0,\"flavanoids\":0.5,\"proline\":600.0,\"malic_acid\":2.81,\"ash\":2.7,\"nonflavanoid_phenols\":0.53,\"hue\":0.77,\"color_intensity\":4.6,\"ml\":{\"inference\":{\"predicted_value\":\"2\",\"model_id\":\"wine-classifier\"}}},\"_ingest\":{\"timestamp\":\"2020-07-08T15:35:49.989672Z\"}}}]})"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"es_index_pattern: nyc-restaurants\n",
"Index:\n",
" es_index_field: _id\n",
" is_source_field: False\n",
"Mappings:\n",
" capabilities:\n",
" es_field_name is_source es_dtype es_date_format pd_dtype is_searchable is_aggregatable is_scripted aggregatable_es_field_name\n",
"camis camis True long None int64 True True False camis\n",
"dba dba True text None object True False False None\n",
"boro boro True keyword None object True True False boro\n",
"building building True keyword None object True True False building\n",
"street street True keyword None object True True False street\n",
"zipcode zipcode True short None int64 True True False zipcode\n",
"phone phone True keyword None object True True False phone\n",
"cuisine_description cuisine_description True keyword None object True True False cuisine_description\n",
"inspection_date inspection_date True keyword None object True True False inspection_date\n",
"action action True keyword None object True True False action\n",
"violation_code violation_code True keyword None object True True False violation_code\n",
"violation_description violation_description True keyword None object True True False violation_description\n",
"critical_flag critical_flag True keyword None object True True False critical_flag\n",
"score score True double None float64 True True False score\n",
"grade grade True keyword None object True True False grade\n",
"grade_date grade_date True keyword None object True True False grade_date\n",
"record_date record_date True keyword None object True True False record_date\n",
"inspection_type inspection_type True keyword None object True True False inspection_type\n",
"community_board community_board True double None float64 True True False community_board\n",
"council_district council_district True double None float64 True True False council_district\n",
"census_tract census_tract True double None float64 True True False census_tract\n",
"bin bin True double None float64 True True False bin\n",
"bbl bbl True double None float64 True True False bbl\n",
"nta nta True keyword None object True True False nta\n",
"location location True geo_point None object True True False location\n",
"Operations:\n",
" tasks: [('boolean_filter': ('boolean_filter': {'script': {'script': {'source': \"doc['zipcode'].value > doc['score'].value\", 'lang': 'painless'}}}))]\n",
" size: None\n",
" sort_params: None\n",
" _source: ['camis', 'dba', 'boro', 'building', 'street', 'zipcode', 'phone', 'cuisine_description', 'inspection_date', 'action', 'violation_code', 'violation_description', 'critical_flag', 'score', 'grade', 'grade_date', 'record_date', 'inspection_type', 'community_board', 'council_district', 'census_tract', 'bin', 'bbl', 'nta', 'location']\n",
" body: {'query': {'script': {'script': {'source': \"doc['zipcode'].value > doc['score'].value\", 'lang': 'painless'}}}}\n",
" post_processing: []\n",
"\n"
]
}
],
"source": [
"print(df[df[\"zipcode\"] > df[\"score\"]].es_info())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}