Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

codeaudit/data-forge-ts

Open more actions menu
 
 

Repository files navigation

Data-Forge

The JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.

Implemented in TypeScript, used in JavaScript ES5+ or TypeScript.

Why not do your data wrangling, analysis and visualization entirely in JavaScript? To support my effort please buy or help promote my book Data Wrangling with JavaScript.

Or check out my blog: The Data Wrangler.

Build Status Coverage Status npm version GitHub license GitHub issues

Please note that this repository replaces the old version of Data-Forge.

Install

npm install --save data-forge

Quick start

Data-Forge can load CSV, JSON or arbitrary data sets.

Parse the data, filter it, transform it, aggregate it, sort it and much more.

Use the data however you want or export it to CSV or JSON.

Here's an example:

const dataForge = require('data-forge');
dataForge.readFile('./input-data-file.csv') // Read CSV file (or JSON!)
    .parseCSV()
    .parseDates(["Column B"]) // Parse date columns.
    .parseInts(["Column B", "Column C"]) // Parse integer columsn.
    .parseFloats(["Column D", "Column E"]) // Parse float columns.
    .dropSeries(["Column F"]) // Drop certain columns.
    .where(row => predicate(row)) // Filter rows.
    .select(row => transform(row)) // Transform the data.
    .asCSV() 
    .writeFile("./output-data-file.csv") // Write to output CSV file (or JSON!)
    .then(() => {
        console.log("Done!");
    })
    .catch(err => {
        console.log("An error occurred!");
    });

From the browser

Data-Forge also works in the browser (just don't try call readFile, etc - some functions only work under Node.js).

Install

Install via Bower (you can also use Browserify or Webpack, see below).

bower install --save data-forge

Include

Include the code in your HTML

<script language="javascript" type="text/javascript" src="bower_components/data-forge/data-forge.js"></script>

Use

Use it via the dataForge global variable.

var myDataframe = new dataForge.DataFrame(... your data here ...);

Features

  • Import and export CSV and JSON data and text files.
  • Also work with arbitrary JavaScript data.
  • Many options for working with your data:
    • Filtering
    • Transformation
    • Extracting subsets
    • Grouping, aggregation and summarization
    • Sorting
    • And much more
  • Great for slicing and dicing tabular data:
    • Add, remove, transform and generate named columns (series) of data.
  • Great for working with time series data.
  • Your data is indexed so you have the ability to merge and aggregate.
  • Your data is immutable! Transformations and modifications produce a new dataset.
  • Build data pipeline that are evaluated lazily.
  • Inspired by Pandas and LINQ, so it might feel familiar!

Platforms

Documentation

Resources

About

The JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.