# dataframe

> Explore data by grouping and reducing.

Latest version **2.0.1** (published 2016-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install dataframe
pnpm add dataframe
yarn add dataframe
bun add dataframe
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2016-11-29 |
| First published | 2013-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37 |
| Author | David Guttman |
| Maintainers | dguttman |

## Links

- npm: https://www.npmjs.com/package/dataframe
- Repository: https://github.com/davidguttman/node-dataframe
- Issues: https://github.com/davidguttman/node-dataframe/issues
- npm.io page: https://npm.io/package/dataframe

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) >=4.1.0

## Recent versions

- 2.0.1 (latest) — 2016-11-29
- 2.0.0 — 2016-11-21
- 1.5.0 — 2016-06-07
- 1.4.0 — 2016-06-04
- 1.3.0 — 2015-05-13
- 1.2.3 — 2015-03-05
- 1.2.2 — 2015-03-05
- 1.2.1 — 2015-03-05
- 1.2.0 — 2015-03-05
- 1.1.1 — 2015-03-02
- 1.1.0 — 2015-03-02
- 1.0.2 — 2015-03-02
- 1.0.1 — 2015-03-02
- 1.0.0 — 2015-03-02
- 0.0.0 — 2013-01-02

## README

# DataFrame #

Explore data by grouping and reducing.

## Example ##

```js

var DataFrame = require('..')

var data = require('./data.json')

var dimensions = [
  {value: 'firstName', title: 'First Name'},
  {value: 'lastName', title: 'Last Name'},
  {value: 'state', title: 'State'},
  {value: function(row) {
    return row.transaction.business
  }, title: 'Business'},
  {value: function(row) {
    return row.transaction.type
  }, title: 'Transaction Type'}
]

var reduce = function(row, memo) {
  memo.count = (memo.count || 0) + 1
  memo.amountTotal = (memo.amountTotal || 0) + parseFloat(row.transaction.amount)
  return memo
}

var df = DataFrame({
  rows: data,
  dimensions: dimensions,
  reduce: reduce
})

var results = df.calculate({
  dimensions: ['First Name', 'Last Name'],
  sortBy: 'amountTotal',
  sortDir: 'desc',
  // optionally filter results based on dimension values
  filter: function(dimensions) {
    return dimensions['First Name'] === 'Maximilian'
  }
})

console.log('results', results)

```


## License ##

MIT

---
_Source: https://npm.io/package/dataframe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
