🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

index-align-ndarray

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

index-align-ndarray

Get index aligned table from nx2 tables of different length

1.0.4
latest
npm
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

index-align-ndarray

Build Status

Given multiple nx2 ndarrays with a index column in ascending order, return a index aligned ndarray.

Good for aligning data based on dates, and the default behavior is to populate the new array's row if and only if there exists same index (data in first column) for all datasets provided.

e.g.

table1
10 1
12 3
15 4
20 1

table2
10 2
11 1
12 4
13 5
15 2
35 2

align([table1,table2]) ->
10 1 2
12 3 4
15 4 2

Usage

var ndarray = require('ndarray');
var align = require('index-align-ndarray');

var table1 = ndarray( new Float32Array([1,2,2,3,3,4,9,5]), [4,2], [2,1] );
var table2 = ndarray( new Float32Array([1,8,3,9,6,4,9,5]), [4,2], [2,1] );
var table3 = ndarray( new Float32Array([1,3,3,6,6,4,9,3]), [4,2], [2,1] );
var table4 = ndarray( new Float32Array([1,4,3,7,5,4,9,1]), [4,2], [2,1] );
var table5 = ndarray( new Float32Array([1,5,3,8,6,1,9,0]), [4,2], [2,1] );

var tables = [table1, table2, table3, table4, table5];
align( tables, function( err, data ) {
  // do something with returned data
});

Limitations

2-D Tables only.

Keywords

ndarray

FAQs

Package last updated on 02 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts