Skip to main content
100%

Loading and Parsing UScrime Data

✓ Published1🌍 Public
RRuofan Chen
Last edited Sep 27, 2021
Created on Sep 7, 2021

This example loads and parses UScrime data from a CSV file, displaying the dataset’s size in kilobytes, row count, and column count. The data, sourced from the FBI’s website, records reported crimes across U.S. states from 2015 to 2019. The visualization uses D3 v7, specifically `d3.csv` to fetch and parse the data, then updates the text content of a DOM element with the summary statistics. The code also demonstrates alternative parsing methods using `fetch` and `d3.csvParse`.

AI-generated description

Data

A program that loads and parses UScrime data. This data is collected from FBI's website. This data records all crimes reported to FBI from 2015 to 2019.

Data structure:

  • year (quantitative): the year the crime was reported
  • state (categorical): reported crime location
  • area (categorical): which area the crime belongs to (Metropolitan Statistical Area,Cities outside metropolitan areas,Nonmetropolitan counties,state total)
  • population (quantitative): the population of the state
  • crime_type (categorical): which type of crime
  • number (quantitative): number of crime

Question:

  • How has the number of crimes changed over time?
  • For a specific type of crime, which area occurs most often?
  • Is the number of crimes relevant in terms of location?
MIT Licensed

Similar vizzes