{"id":13510300,"url":"https://github.com/vega/datalib","last_synced_at":"2025-05-15T11:01:44.417Z","repository":{"id":30394673,"uuid":"33947393","full_name":"vega/datalib","owner":"vega","description":"JavaScript data utility library.","archived":false,"fork":false,"pushed_at":"2022-03-17T10:59:07.000Z","size":3436,"stargazers_count":734,"open_issues_count":15,"forks_count":132,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-05-05T13:41:06.888Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://vega.github.io/datalib/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vega.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-14T17:45:56.000Z","updated_at":"2025-03-12T01:57:41.000Z","dependencies_parsed_at":"2022-07-30T08:18:08.685Z","dependency_job_id":null,"html_url":"https://github.com/vega/datalib","commit_stats":null,"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vega%2Fdatalib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vega%2Fdatalib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vega%2Fdatalib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vega%2Fdatalib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vega","download_url":"https://codeload.github.com/vega/datalib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254179904,"owners_count":22027884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:01:32.697Z","updated_at":"2025-05-15T11:01:44.395Z","avatar_url":"https://github.com/vega.png","language":"JavaScript","readme":"# datalib\n\n[![Build Status](https://travis-ci.org/vega/datalib.svg?branch=master)](https://travis-ci.org/vega/datalib)\n[![npm version](https://img.shields.io/npm/v/datalib.svg)](https://www.npmjs.com/package/datalib)\n\n_**NOTE:** Datalib is no longer being actively maintained. The [Arquero](https://github.com/uwdata/arquero) library provides similar functionality plus much more. In addition, Vega now includes its own data utilities in the [vega-util](https://github.com/vega/vega/tree/master/packages/vega-util) and [vega-statistics](https://github.com/vega/vega/tree/master/packages/vega-statistics) packages._\n\nDatalib is a JavaScript data utility library. It provides facilities for data loading, type inference, common statistics, and string templates. While datalib was created to power [Vega](http://vega.github.io) and related projects, it is also a standalone library useful for data-driven JavaScript applications on both the client (web browser) and server (e.g., node.js).\n\nFor documentation, see the datalib [API Reference](../../wiki/API-Reference).\n\n## Use\n\nDatalib provides a set of utilities for working with data. These include:\n\n- Loading and parsing data files (JSON, TopoJSON, CSV, TSV).\n- Summary statistics (mean, deviation, median, correlation, histograms, etc).\n- Group-by aggregation queries, including streaming data support.\n- Data-driven string templates with expressive formatting filters.\n- Utilities for working with JavaScript functions, objects and arrays.\n\nDatalib can be used both server-side and client-side. For use in node.js,\nsimply `npm install datalib` or include datalib as a dependency in your package.json file. For use on the client, install datalib via `bower install datalib` or include datalib.min.js on your web page. The minified JS file is built using rollup (see below for details).\n\n### Example\n\n```javascript\n// Load datalib.\nvar dl = require('datalib');\n\n// Load and parse a CSV file. Datalib does type inference for you.\n// The result is an array of JavaScript objects with named values.\n// Parsed dates are stored as UNIX timestamp values.\nvar data = dl.csv('https://vega.github.io/datalib/data/stocks.csv');\n\n// Show summary statistics for each column of the data table.\nconsole.log(dl.format.summary(data));\n\n// Compute mean and standard deviation by ticker symbol.\nvar rollup = dl.groupby('symbol')\n  .summarize({'price': ['mean', 'stdev']})\n  .execute(data);\nconsole.log(dl.format.table(rollup));\n\n// Compute correlation measures between price and date.\nconsole.log(\n  dl.cor(data, 'price', 'date'),      // Pearson product-moment correlation\n  dl.cor.rank(data, 'price', 'date'), // Spearman rank correlation\n  dl.cor.dist(data, 'price', 'date')  // Distance correlation\n);\n\n// Compute mutual information distance between years and binned price.\nvar bin_price = dl.$bin(data, 'price'); // returns binned price values\nvar year_date = dl.$year('date');       // returns year from date field\nvar counts = dl.groupby(year_date, bin_price).count().execute(data);\nconsole.log(dl.mutual.dist(counts, 'bin_price', 'year_date', 'count'));\n```\n\n## Build Process\n\nTo use datalib in the browser, you need to build the datalib.js and datalib.min.js files. We assume that you have [npm](https://www.npmjs.com/) installed.\n\n1. Run `npm install` in the datalib folder to install dependencies.\n2. Run `npm run build`. This will invoke [rollup](https://rollupjs.org) to bundle the source files into datalib.js, and then [uglify-js](http://lisperator.net/uglifyjs/) to create the minified datalib.min.js.\n\n\n### Webpack 1\n\nIf you are using Webpack 1, you need to enable a JSON-loader. To do so, first `npm install --save json-loader`, then add the loader to your webpack config:\n\n```js\n{\n  module: {\n    loaders: [{\n      test: /\\.json$/,\n      loader: 'json-loader'\n    }]\n  }\n}\n```\n","funding_links":[],"categories":["JavaScript","others","Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvega%2Fdatalib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvega%2Fdatalib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvega%2Fdatalib/lists"}