Pandas for JavaScript

Zero dependencies. Pandas-inspired API. 503 tests verified against Python.

$ npm install @rockiey/pandasjs
Get Started View on GitHub

Features

0

Zero Dependencies

Pure JavaScript implementation. No native modules, no heavy bundles. Just import and go.

>

Lightweight & Fast

Typically 1-3x faster than Python pandas on small data. Some operations are comparable. 503 tests verified.

=

Pandas-Inspired API

Familiar method names and patterns for Python pandas users. Not a full port, but covers common operations.

#

DataFrame & Series

DataFrame and Series with iloc, loc, groupby, merge, pivot, melt, and more.

~

Window & GroupBy

Rolling, expanding, and exponential weighted windows. Multi-column groupby with agg, transform, filter.

@

Run Python Code

Use pd.run() to transpile Python pandas code to JS and run it natively. No Pyodide needed.

Install

$ npm install @rockiey/pandasjs // then in your code import pd from '@rockiey/pandasjs'

Quick Example

import pd from '@rockiey/pandasjs'
const df = pd.DataFrame({
name: ['Alice', 'Bob', 'Charlie', 'Alice', 'Bob'],
score: [85, 92, 78, 95, 88],
grade: ['A', 'A', 'B', 'A', 'B']
})
// groupby + aggregation
const result = df.groupby('name').agg({score: ['mean', 'max']})
console.log(result.toString())
// rolling mean
const rolling = df.col('score').rolling(2).mean()
// transpile Python pandas code to JS and run
const pyDf = pd.run(` df = pd.DataFrame({'x': [1,2,3], 'y': [4,5,6]}) df.describe() `)

Performance

503 tests verified against Python pandas. Timings measured on small test data — results vary by workload and environment.

Area Python JavaScript Ratio
Creation & Access 0.72 ms 0.83 ms 0.9x
Selection & Indexing 1.68 ms 1.08 ms 1.6x
Computation 2.91 ms 1.34 ms 2.2x
Reshaping 5.40 ms 2.43 ms 2.2x
Advanced 5.70 ms 2.05 ms 2.8x
Window 2.12 ms 1.93 ms 1.1x
GroupBy & Merge 7.83 ms 2.05 ms 3.8x
IO & Data Types 4.42 ms 1.79 ms 2.5x
DateTime & Strings 3.64 ms 2.21 ms 1.6x
Utilities 4.24 ms 1.82 ms 2.3x
Arithmetic & Conversions 2.31 ms 2.04 ms 1.1x
Cumulative & Stats 2.81 ms 2.05 ms 1.4x
GroupBy Enhancements 2.03 ms 1.18 ms 1.7x
Reshape & Top-level 5.34 ms 2.03 ms 2.6x
String & Window Ext 1.98 ms 1.64 ms 1.2x