Fork me on GitHub

Learn JS Data

Data cleaning, manipulation, and wrangling in JavaScript

About this guide

This guide teaches the basics of manipulating data using JavaScript in the browser, or in node.js. Specifically, these tasks are geared around preparing data for further analysis and visualization.

Here we demonstrate some basic techniques and how to implement them using core JavaScript API, the d3.js library and lodash.

It assumes you already have some basic knowledge of JavaScript.

Tasks

News

01/11/2019: We also have an amazing Observable version of the guide provided by the very talented @dakoop. Observable is a great, interactive way to try out JavaScript. Give it a try now!

01/10/2019: We've updated the guide to use D3v5. The new changes mostly impact the "Reading in Data" section of the guide. A very special thank you goes out to Erin Brown who contributed the PR to make this happen! We really appreciate the help!

03/20/2017: We've updated the guide to use D3v4!! Thanks very much to Kanit Ham Wong and others at the UW Interactive Data Lab for support, suggestions, and motivation for this process. Thanks to Adam Pearce for doing most of the converting!

If you need the old D3v3 guide, its been archived here

Code

Each document in this repo is executed when loaded into a browser. Check it out by opening the Developer Tools Console. You should see the output of the following code block:

console.log("This is the index!");

Check out the full source on github.

Why?

Is data cleaning and processing in JavaScript something you would actually want to do? Maybe.

There are other languages out there that do a great job with data wrangling:

These tools are great and you should use them. Often times, however, you are already familiar with a particular language (like JavaScript) and would like to get started with data, but want to take it one step at a time.

Additionally, sometimes you are already in a particular environment (like JavaScript) and don't have the luxury of switching to one of these other options.

In these cases, JavaScript could be considered a viable option for your data analysis. And if you find yourself in one of these situations, or just want to try out JavaScript for data analysis for fun, then this guide is for you!

Check out some of the tasks, and see if JavaScript Data something you want to try yourself.

Thanks!

This guide is the result of quite a team effort.

Its inspiration came from a ponderous tweet by the one and only Lynn Cherney, who lamented the dirth of JavaScript data guidance at the time.

The beautiful folks at Bocoup are the reason this guide exists. They had the foresight to provide the all important luxury of time so that it could be written. Thanks to Jory Burson and Boaz Sender for creating a culture that gave space for these kinds of things to be created.

The bulk of this guide was written while at Bocoup by Irene Ros, Yannick Assogba, and Jim Vallandingham.

Since that time, we have had numerous other contributors, who have seen something to improve, and made us all better for their help.

Perhaps hackneyed, but almost always true - It takes a village. So to that village we want to say, "Thanks!".