JavaScript 数据实用程序库:Datalib

y3c5 9年前

Datalib 一个 JavaScript 数据实用程序提供用于数据加载 类型推理 常见统计字符串模板包括:

  • 加载并解析数据文件(JSON, TopoJSON, CSV, TSV).

  • 统计摘要(均值、偏差、中位数、相关测量等).

  • 数据驱动字符串模版,包括一组筛选器.

  • 用于处理 JavaScript 对象数组的实用程序.

代码示例:

// Load datalib.  var dl = require('datalib');     // Load and parse a CSV file. Datalib does type inference for you.  // The result is an array of JavaScript objects with named values.  // Parsed dates are stored as UNIX timestamp values.  var data = dl.csv('http://uwdata.github.io/datalib/data/stocks.csv');     // Show summary statistics for each column of the data table.  console.log(dl.summary(data).toString());     // Compute correlation measures between price and date.  var price = dl.accessor('price');  var date = dl.accessor('date');  console.log(    dl.cor(data, price, date),      // Pearson product-moment correlation    dl.cor.rank(data, price, date), // Spearman rank correlation    dl.cor.dist(data, price, date)  // Distance correlation  );

项目主页:http://www.open-open.com/lib/view/home/1431336175716