Loading Data - Squirrel Census
This example demonstrates the process of loading and parsing a CSV dataset from the Squirrel Census, which contains 433 squirrel sightings across 24 New York City parks. The visualization initially displays a loading state before fetching the data file, then renders the parsed data as a pretty-printed JSON object. The code uses d3.csvParse to convert the CSV string into an array of objects, and then converts specific fields like park_id, above_ground, squirrel_latitude, and squirrel_longitude to numeric values using the unary plus operator. The visualization is built with D3.js version 7.6.1, using the select and join methods to manage the DOM structure.
AI-generated descriptionThis data is from The Squirrel Census and reflects data collected about squirrel sightings across 24 parks in New York City on March 4th, 2022. It was ran by 72 volunteers and NYC Open Data. There are 433 sightings counted.
The paper can be read here and is a fun read: https://www.thesquirrelcensus.com/data
Attributes include the following:
- Area name: categorical nominal (sections of NY)
- Area ID: nominal qualitative
- Park name: categorical nominal
- Park ID: nominal qualitative (numbered to represent a place)
- Squirrel ID: nominal qualitative
- Primary fur color: categorical
- Highlights fur color: categorical
- Color notes: categorical
- Location: categorical
- Above Ground: quantitative
- Activities: categorical
- Interactions with humans: categorical
- Squirrel lat: latitude coordinates (DD.DDDDDD format)
- Squirrel long: longitude coordinate (-DD.DDDDDD format)