Public
Edited
Mar 7
Insert cell
Insert cell
Insert cell
Insert cell
import {vl} from "@vega/vega-lite-api-v5"
Insert cell
import {printTable} from "@uwdata/data-utilities"
Insert cell
nypddata = FileAttachment("allegations_202007271729.csv").csv()
Insert cell
printTable(nypddata.slice(0,5))
Insert cell
Insert cell
//filtering data for Complainant ethnicity
nypd_white = nypddata.filter(row => row['complainant_ethnicity'] === 'White')

Insert cell
nypd_blk = nypddata.filter(row => row['complainant_ethnicity'] == 'Black')
Insert cell
uniqueCategories = [...new Set(nypddata.map(item => item.complainant_ethnicity))];

Insert cell
nypd_asian = nypddata.filter(row => row['complainant_ethnicity'] == 'Asian')
Insert cell
nypd_native = nypddata.filter(row => row['complainant_ethnicity'] == 'American Indian')
Insert cell
nypd_hisp = nypddata.filter(row => row['complainant_ethnicity'] == 'Hispanic')
Insert cell
nypd_other = nypddata.filter(row => row['complainant_ethnicity'] == 'Other Race')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more