pandas-js
Pandas for JavaScript
pandas.js is an open source (experimental) library mimicking the
Python pandas library. It relies on
Immutable.js as the
NumPy base. The main data
objects in pandas.js are the Series
and the
DataFrame
Documentation
See the docs
See also this post on use for optimizing React logic.
Installation and use
$ npm install pandas-js
Importing
Series
and
DataFrame
;
Create a new Series
const ds = 1 2 3 4 name: 'My test name' index: 2 3 4 5ds// Returns:// 2 1// 3 2// 4 3// 5 4// Name: My test name, dtype: dtype(int)
Filter a Series
const ds = 1 2 3; // Returns Series([2, 3]);ds;
Filtering can be done with generic methods
const ds = 1 2 3 name: 'Test name' // Returns Series([true, false, false])ds; // Returns Series([false, true, true])ds; // Returns Series([false, true, true])ds; // Returns Series([false, true, true])ds; // Returns Series([2, 3])ds;
Create a new DataFrame
const df = x: 1 y: 2 x: 2 y: 3 x: 3 y: 4 // Returns:// x | y// 0 1 | 2// 1 2 | 3// 2 3 | 4df;
Filtering a DataFrame
const df = Immutable; // Returns DataFrame(Immutable.Map({x: Series([2]), y: Series([3]));df; // Returns DataFrame(Immutable.Map({x: Series([2]), y: Series([3]));df; // Returns DataFrame(Immutable.Map({x: Series([2]), y: Series([3]));df;
Development
Testing and build
$ npm run test
$ npm run build
Testing uses Jest. Building requires the babel compiler.