Registry / database / nodejs-polars

nodejs-polars

JSON →
library0.24.1jsnpmunverified

nodejs-polars is a Node.js binding for the Polars DataFrame library, built on Rust for performance. Version 0.24.1 requires Node >= 20, ships TypeScript types, and supports ESM and CJS. It provides fast data manipulation via lazy and eager APIs, with features like groupby, join, sort, and window functions. Key differentiators: significantly faster than pandas, lower memory usage, and a more expressive API. Released frequently (weekly/monthly), tracking the Rust core.

npm install nodejs-polars
INSTALL
IMPORT
SIG · NODEJS-POLARS
N
nodejs-polars
databasejavascriptv0.24.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pl
✓ import pl from 'nodejs-polars'
✗ const pl = require('nodejs-polars')
Both ESM and CJS supported. ESM is recommended for Node >= 20.
DataFrame
✓ import { DataFrame } from 'nodejs-polars'
✗ const { DataFrame } = require('nodejs-polars')
Named export for TypeScript type usage.
Series
✓ import { Series } from 'nodejs-polars'
Named export for TypeScript type usage.

Demonstrates creating a DataFrame, filtering, grouping, and the lazy API with collect.

import pl from 'nodejs-polars'; // Create a DataFrame const df = pl.DataFrame({ name: ["Alice", "Bob", "Charlie"], age: [25, 30, 35], city: ["New York", "London", "Paris"] }); // Perform operations const filtered = df.filter(pl.col("age").gt(25)); const aggregated = df.groupBy("city").agg(pl.col("age").mean()); console.log(filtered); console.log(aggregated); // Lazy API const lf = df.lazy() .filter(pl.col("age").gt(25)) .select(["name", "age"]); const result = await lf.collect(); console.log(result);
Debug
Known issues
gotchaDefault import uses `import pl from 'nodejs-polars'`, not named imports.
fix
Use default import for the main pl object.
affects: *
breakingVersion 0.14.0 changed the lazy API to require async `collect()`.
fix
Use `await lf.collect()` and ensure calling context is async.
affects: >=0.14.0
deprecatedSome function parameters have been renamed; e.g., `sort(descending: true)` changed to `sort({ descending: true })`.
fix
Pass arguments as a configuration object instead of positional booleans.
affects: >=0.18.0
gotchaSeries indices are zero-based but normal array indexing works; negative indexing is not supported.
fix
Use `.get(idx)` for negative indices or slice.
affects: *
breakingMinimum Node.js version is now 20; older versions are not supported.
fix
Upgrade to Node.js >=20.
affects: >=0.24.0
deprecated`pl.lit()` is used for literal values; there's no alternative at this time.
fix
Continue using `pl.lit()` as it's still current.
affects: *
Errors
Common errors & fixes
Error: Must use import to load ES Module: /path/to/node_modules/nodejs-polars/lib/index.js
Using `require()` on an ESM-only module.
fix
Use `import pl from 'nodejs-polars'` in your code, or ensure your Node.js version supports ESM and add `"type": "module"` to your package.json.
TypeError: pl.DataFrame is not a constructor
Attempting to import named export 'DataFrame' from default import pl. Actually, pl.DataFrame is a method, not a class constructor in older versions.
fix
Use `pl.DataFrame({...})` directly for constructing DataFrames.
TypeError: Cannot read properties of undefined (reading 'collect')
Incorrect usage of lazy API: `collect` is not called or called synchronously.
fix
Use `await lf.collect()` and ensure the surrounding function is async.
Upgrade
Version history
0.24.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
nodejs-polars — npm install nodejs-polars · libregistry