向波士顿市报告了 311 次呼叫。
请参阅此链接以详细了解 BOS:311。
数量和保留期
此数据集以 Parquet 格式存储。 它每天更新一次,截至 2019 年总共包含约 10 万行 (10 MB)。
此数据集包含从 2011 年至今累积的历史记录。 可使用我们的 SDK 中的参数设置来提取特定时间范围内的数据。
存储位置
此数据集存储在美国东部 Azure 区域。 建议将计算资源分配到美国东部地区,以实现相关性。
其他信息
此数据集来自波士顿市政府。 有关更多详细信息,请参阅此处。 有关使用此数据集的许可,请参阅开放数据共享公共域奉献与许可 (ODC PDDL)。
通知
Microsoft 以“原样”为基础提供 AZURE 开放数据集。 Microsoft 对数据集的使用不提供任何担保(明示或暗示)、保证或条件。 在当地法律允许的范围内,Microsoft 对使用数据集而导致的任何损害或损失不承担任何责任,包括直接、必然、特殊、间接、偶发或惩罚。
此数据集是根据 Microsoft 接收源数据的原始条款提供的。 数据集可能包含来自 Microsoft 的数据。
Access
Available in | When to use |
---|---|
Azure Notebooks | Quickly explore the dataset with Jupyter notebooks hosted on Azure or your local machine. |
Azure Databricks | Use this when you need the scale of an Azure managed Spark cluster to process the dataset. |
Azure Synapse | Use this when you need the scale of an Azure managed Spark cluster to process the dataset. |
Preview
dataType | dataSubtype | dateTime | category | subcategory | status | address | latitude | longitude | source | extendedProperties |
---|---|---|---|---|---|---|---|---|---|---|
Safety | 311_All | 1/19/2021 11:52:50 PM | Enforcement & Abandoned Vehicles | Parking Enforcement | Open | 89 Welles Ave Dorchester MA 02124 | 42.2891 | -71.0664 | Citizens Connect App | |
Safety | 311_All | 1/19/2021 11:36:00 PM | Highway Maintenance | Work Hours-Loud Noise Complaints | Open | 1241 Adams St Mattapan MA 02124 | 42.2713 | -71.0694 | Constituent Call | |
Safety | 311_All | 1/19/2021 11:31:22 PM | Enforcement & Abandoned Vehicles | Parking Enforcement | Open | 129 H St South Boston MA 02127 | 42.3333 | -71.0416 | Citizens Connect App | |
Safety | 311_All | 1/19/2021 11:15:00 PM | Fire Hydrant | Fire Hydrant | Open | INTERSECTION of Itasca St & Messinger St Mattapan MA | 42.3594 | -71.0587 | Constituent Call | |
Safety | 311_All | 1/19/2021 11:11:00 PM | Street Cleaning | Requests for Street Cleaning | Closed | INTERSECTION of Southampton St & Frontage Rd Dorchester MA | 42.3594 | -71.0587 | Constituent Call | |
Safety | 311_All | 1/19/2021 11:09:00 PM | Weights and Measures | Scanning Overcharge | Open | 370 Western Ave Brighton MA 02135 | 42.3609 | -71.1376 | Constituent Call | |
Safety | 311_All | 1/19/2021 11:08:00 PM | Building | Work w/out Permit | Open | 68 Seaverns Ave Jamaica Plain MA 02130 | 42.3115 | -71.1104 | Constituent Call | |
Safety | 311_All | 1/19/2021 11:07:00 PM | Housing | Overcrowding | Open | 2033 Columbus Ave Roxbury MA 02119 | 42.3143 | -71.0968 | Constituent Call | |
Safety | 311_All | 1/19/2021 11:04:00 PM | Building | Working Beyond Hours | Open | 69 N Margin St Boston MA 02113 | 42.3657 | -71.0568 | Constituent Call | |
Safety | 311_All | 1/19/2021 11:03:00 PM | Building | Working Beyond Hours | Open | 210 Endicott St Boston MA 02113 | 42.3664 | -71.0581 | Constituent Call |
Name | Data type | Unique | Values (sample) | Description |
---|---|---|---|---|
address | string | 141,783 | \" \" 1 City Hall Plz Boston MA 02108 |
位置。 |
category | string | 54 | Street Cleaning Sanitation |
服务请求原因。 |
dataSubtype | string | 1 | 311_All | “311_All” |
dataType | string | 1 | Safety | “Safety” |
dateTime | timestamp | 1,701,671 | 2015-07-23 10:51:00 2015-07-23 10:47:00 |
服务请求的公开日期和时间。 |
latitude | double | 1,622 | 42.3594 42.3603 |
这是纬度值。 纬线平行于赤道。 |
longitude | double | 1,806 | -71.0587 -71.0583 |
这是经度值。 经度线垂直于纬度线,并且都穿过两个极点。 |
source | string | 7 | Constituent Call Citizens Connect App |
案件的原始来源。 |
status | string | 2 | Closed Open |
事件状态。 |
subcategory | string | 208 | Parking Enforcement Requests for Street Cleaning |
服务请求类型。 |
Azure Notebooks
# This is a package in preview.
from azureml.opendatasets import BostonSafety
from datetime import datetime
from dateutil import parser
end_date = parser.parse('2016-01-01')
start_date = parser.parse('2015-05-01')
safety = BostonSafety(start_date=start_date, end_date=end_date)
safety = safety.to_pandas_dataframe()
safety.info()
# Pip install packages
import os, sys
!{sys.executable} -m pip install azure-storage-blob
!{sys.executable} -m pip install pyarrow
!{sys.executable} -m pip install pandas
# Azure storage access info
azure_storage_account_name = "azureopendatastorage"
azure_storage_sas_token = r""
container_name = "citydatacontainer"
folder_name = "Safety/Release/city=Boston"
from azure.storage.blob import BlockBlobServicefrom azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
if azure_storage_account_name is None or azure_storage_sas_token is None:
raise Exception(
"Provide your specific name and key for your Azure Storage account--see the Prerequisites section earlier.")
print('Looking for the first parquet under the folder ' +
folder_name + ' in container "' + container_name + '"...')
container_url = f"https://{azure_storage_account_name}.blob.core.windows.net/"
blob_service_client = BlobServiceClient(
container_url, azure_storage_sas_token if azure_storage_sas_token else None)
container_client = blob_service_client.get_container_client(container_name)
blobs = container_client.list_blobs(folder_name)
sorted_blobs = sorted(list(blobs), key=lambda e: e.name, reverse=True)
targetBlobName = ''
for blob in sorted_blobs:
if blob.name.startswith(folder_name) and blob.name.endswith('.parquet'):
targetBlobName = blob.name
break
print('Target blob to download: ' + targetBlobName)
_, filename = os.path.split(targetBlobName)
blob_client = container_client.get_blob_client(targetBlobName)
with open(filename, 'wb') as local_file:
blob_client.download_blob().download_to_stream(local_file)
# Read the parquet file into Pandas data frame
import pandas as pd
print('Reading the parquet file into Pandas data frame')
df = pd.read_parquet(filename)
# you can add your filter at below
print('Loaded as a Pandas data frame: ')
df
Azure Databricks
# This is a package in preview.
# You need to pip install azureml-opendatasets in Databricks cluster. https://docs.microsoft.com/en-us/azure/data-explorer/connect-from-databricks#install-the-python-library-on-your-azure-databricks-cluster
from azureml.opendatasets import BostonSafety
from datetime import datetime
from dateutil import parser
end_date = parser.parse('2016-01-01')
start_date = parser.parse('2015-05-01')
safety = BostonSafety(start_date=start_date, end_date=end_date)
safety = safety.to_spark_dataframe()
display(safety)
# Azure storage access info
blob_account_name = "azureopendatastorage"
blob_container_name = "citydatacontainer"
blob_relative_path = "Safety/Release/city=Boston"
blob_sas_token = r""
# Allow SPARK to read from Blob remotely
wasbs_path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (blob_container_name, blob_account_name, blob_relative_path)
spark.conf.set(
'fs.azure.sas.%s.%s.blob.core.windows.net' % (blob_container_name, blob_account_name),
blob_sas_token)
print('Remote blob path: ' + wasbs_path)
# SPARK read parquet, note that it won't load any data yet by now
df = spark.read.parquet(wasbs_path)
print('Register the DataFrame as a SQL temporary view: source')
df.createOrReplaceTempView('source')
# Display top 10 rows
print('Displaying top 10 rows: ')
display(spark.sql('SELECT * FROM source LIMIT 10'))
Azure Synapse
from azureml.opendatasets import BostonSafety
from datetime import datetime
from dateutil import parser
end_date = parser.parse('2016-01-01')
start_date = parser.parse('2015-05-01')
safety = BostonSafety(start_date=start_date, end_date=end_date)
safety = safety.to_spark_dataframe()
display(safety)
# Azure storage access info
blob_account_name = "azureopendatastorage"
blob_container_name = "citydatacontainer"
blob_relative_path = "Safety/Release/city=Boston"
blob_sas_token = r""
# Allow SPARK to read from Blob remotely
wasbs_path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (blob_container_name, blob_account_name, blob_relative_path)
spark.conf.set(
'fs.azure.sas.%s.%s.blob.core.windows.net' % (blob_container_name, blob_account_name),
blob_sas_token)
print('Remote blob path: ' + wasbs_path)
# SPARK read parquet, note that it won't load any data yet by now
df = spark.read.parquet(wasbs_path)
print('Register the DataFrame as a SQL temporary view: source')
df.createOrReplaceTempView('source')
# Display top 10 rows
print('Displaying top 10 rows: ')
display(spark.sql('SELECT * FROM source LIMIT 10'))

City Safety
From the Urban Innovation Initiative at Microsoft Research, databricks notebook for analytics with safety data (311 and 911 call data) from major U.S. cities. Analyses show frequency distributions and geographic clustering of safety issues within cities.