Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodejs-polars

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-polars - npm Package Compare versions

Comparing version 0.7.4 to 0.8.0

18

bin/dataframe.js

@@ -48,3 +48,3 @@ "use strict";

let start = 0;
let len = this.width;
const len = this.width;
while (start < len) {

@@ -389,3 +389,3 @@ const s = this.toSeries(start);

}
return wrap("sort", arg, reverse, true);
return wrap("sort", arg, reverse, true, false);
},

@@ -412,3 +412,3 @@ std() {

}
let buffers = [];
const buffers = [];
const writeStream = new stream_1.Stream.Writable({

@@ -444,3 +444,3 @@ write(chunk, _encoding, callback) {

}
let buffers = [];
const buffers = [];
const writeStream = new stream_1.Stream.Writable({

@@ -463,3 +463,3 @@ write(chunk, _encoding, callback) {

}
let buffers = [];
const buffers = [];
const writeStream = new stream_1.Stream.Writable({

@@ -479,3 +479,3 @@ write(chunk, _encoding, callback) {

}
let buffers = [];
const buffers = [];
const writeStream = new stream_1.Stream.Writable({

@@ -498,3 +498,3 @@ write(chunk, _encoding, callback) {

}
let buffers = [];
const buffers = [];
const writeStream = new stream_1.Stream.Writable({

@@ -518,3 +518,3 @@ write(chunk, _encoding, callback) {

transpose(options) {
let df = wrap("transpose", options?.includeHeader ?? false, options?.headerName);
const df = wrap("transpose", options?.includeHeader ?? false, options?.headerName ?? "");
if (options?.columnNames) {

@@ -527,3 +527,3 @@ function* namesIter() {

let next;
// eslint-disable-next-line no-cond-assign
// rome-ignore lint: no-cond-assign
while ((next = gen.next())) {

@@ -530,0 +530,0 @@ yield next.value;

@@ -248,3 +248,3 @@ "use strict";

TimeUnit["Milliseconds"] = "ms";
})(TimeUnit = exports.TimeUnit || (exports.TimeUnit = {}));
})(TimeUnit || (exports.TimeUnit = TimeUnit = {}));
/**

@@ -259,3 +259,3 @@ * @ignore

TimeUnit.from = from;
})(TimeUnit = exports.TimeUnit || (exports.TimeUnit = {}));
})(TimeUnit || (exports.TimeUnit = TimeUnit = {}));
/**

@@ -285,2 +285,2 @@ * Datatype namespace

DataType.deserialize = deserialize;
})(DataType = exports.DataType || (exports.DataType = {}));
})(DataType || (exports.DataType = DataType = {}));

@@ -25,3 +25,3 @@ "use strict";

function from(nameOrObj, dtype) {
if (typeof nameOrObj === "string") {
if (typeof nameOrObj === "string" && dtype) {
return new Field(nameOrObj, dtype);

@@ -37,2 +37,2 @@ }

Field.from = from;
})(Field = exports.Field || (exports.Field = {}));
})(Field || (exports.Field = Field = {}));

@@ -60,3 +60,3 @@ "use strict";

else {
let pairs = Object.entries(aggs[0]).flatMap(([key, values]) => {
const pairs = Object.entries(aggs[0]).flatMap(([key, values]) => {
return [values].flat(2).map((v) => (0, functions_1.col)(key)[v]());

@@ -75,3 +75,3 @@ });

pivot,
aggList: () => agg((0, functions_1.exclude)(by).list()),
aggList: () => agg((0, functions_1.exclude)(by)),
count() {

@@ -78,0 +78,0 @@ return (0, dataframe_1._DataFrame)(df.groupby([by].flat(), null, "count"));

@@ -131,4 +131,4 @@ "use strict";

pl.version = polars_internal_1.default.version();
})(pl = exports.pl || (exports.pl = {}));
})(pl || (exports.pl = pl = {}));
// eslint-disable-next-line no-undef
exports.default = pl;

@@ -51,3 +51,3 @@ "use strict";

const flds = Object.entries(value).map(([name, value]) => {
let dtype = (0, exports.jsTypeToPolarsType)(value);
const dtype = (0, exports.jsTypeToPolarsType)(value);
return field_1.Field.from(name, dtype);

@@ -168,3 +168,3 @@ });

function arrayToJsDataFrame(data, options) {
let columns = options?.columns;
const columns = options?.columns;
let orient = options?.orient;

@@ -197,3 +197,4 @@ let dataSeries;

const df = polars_internal_1.default.fromRows(data);
columns && (df.columns = columns);
if (columns)
df.columns = columns;
return df;

@@ -200,0 +201,0 @@ }

@@ -41,3 +41,3 @@ "use strict";

inferSchemaLength: 50,
format: "lines",
format: "json",
};

@@ -57,4 +57,3 @@ // utility to read streams as lines.

var _a;
var begin = 0;
var position = 0;
let begin = 0;
let i = 0;

@@ -138,3 +137,3 @@ while (i < chunk.length) {

options = { ...readJsonDefaultOptions, ...options };
let method = options.format === "lines" ? polars_internal_1.default.readJsonLines : polars_internal_1.default.readJson;
const method = options.format === "lines" ? polars_internal_1.default.readJsonLines : polars_internal_1.default.readJson;
const extensions = [".ndjson", ".json", ".jsonl"];

@@ -237,4 +236,4 @@ if (Buffer.isBuffer(pathOrBody)) {

pliOptions.rowCount = options?.rowCount;
const parallel = options?.parallel ?? "auto";
return (0, dataframe_2._LazyDataFrame)(polars_internal_1.default.scanParquet(path, pliOptions, parallel));
pliOptions.parallel = options?.parallel ?? "auto";
return (0, dataframe_2._LazyDataFrame)(polars_internal_1.default.scanParquet(path, pliOptions));
}

@@ -265,5 +264,5 @@ exports.scanParquet = scanParquet;

function readCSVStream(stream, options) {
let batchSize = options?.batchSize ?? 10000;
const batchSize = options?.batchSize ?? 10000;
let count = 0;
let end = options?.endRows ?? Number.POSITIVE_INFINITY;
const end = options?.endRows ?? Number.POSITIVE_INFINITY;
return new Promise((resolve, reject) => {

@@ -283,3 +282,3 @@ const s = stream.pipe(new LineBatcher({ batchSize }));

try {
let buff = Buffer.concat(chunks);
const buff = Buffer.concat(chunks);
const df = readCSVBuffer(buff, options);

@@ -286,0 +285,0 @@ resolve(df);

@@ -7,3 +7,3 @@ import { DataFrame } from "../dataframe";

import { LazyOptions, LazyJoinOptions } from "../types";
import { Series } from "@polars/series";
import { Series } from "../series";
declare const inspect: unique symbol;

@@ -10,0 +10,0 @@ /**

@@ -151,3 +151,3 @@ "use strict";

},
groupByDynamic({ indexColumn, every, period, offset, truncate, includeBoundaries, closed, by, }) {
groupByDynamic({ indexColumn, every, period, offset, truncate, includeBoundaries, closed, by, start_by, }) {
period = period ?? every;

@@ -159,3 +159,4 @@ offset = offset ?? `-${period}`;

includeBoundaries = includeBoundaries ?? false;
const lgb = _ldf.groupbyDynamic(indexColumn, every, period, offset, truncate, includeBoundaries, closed, by);
start_by = start_by ?? "monday";
const lgb = _ldf.groupbyDynamic(indexColumn, every, period, offset, truncate, includeBoundaries, closed, by, start_by);
return (0, groupby_1._LazyGroupBy)(lgb);

@@ -313,3 +314,3 @@ },

if (typeof arg === "string") {
return wrap("sort", arg, reverse, true);
return wrap("sort", arg, reverse, true, false);
}

@@ -316,0 +317,0 @@ else {

@@ -6,4 +6,3 @@ import { DateFunctions } from "../../shared_traits";

*/
export interface ExprDateTime extends DateFunctions<Expr> {
}
export type ExprDateTime = DateFunctions<Expr>;
export declare const ExprDateTimeFunctions: (_expr: any) => ExprDateTime;

@@ -119,3 +119,3 @@ "use strict";

reverse = reverse?.reverse ?? reverse;
return (0, exports._Expr)(_expr.argSort(reverse));
return (0, exports._Expr)(_expr.argSort(reverse, false));
},

@@ -429,5 +429,5 @@ argUnique() {

if (typeof reverse === "boolean") {
return wrap("sortWith", reverse, nullsLast);
return wrap("sortWith", reverse, nullsLast, false);
}
return wrap("sortWith", reverse?.reverse ?? false, reverse?.nullsLast ?? nullsLast);
return wrap("sortWith", reverse?.reverse ?? false, reverse?.nullsLast ?? nullsLast, false);
},

@@ -434,0 +434,0 @@ sortBy(arg, reverse = false) {

@@ -6,4 +6,3 @@ import { Expr } from "../expr";

*/
export interface ExprList extends ListFunctions<Expr> {
}
export type ExprList = ListFunctions<Expr>;
export declare const ExprListFunctions: (_expr: any) => ExprList;

@@ -26,3 +26,3 @@ "use strict";

contains(pat) {
return wrap("strContains", (0, utils_1.regexToString)(pat));
return wrap("strContains", (0, utils_1.regexToString)(pat), false);
},

@@ -29,0 +29,0 @@ decode(arg, strict = false) {

@@ -100,3 +100,3 @@ import { Expr } from "./expr";

export declare function cols(col: string | string[]): Expr;
export declare function cols(col: string, ...cols: string[]): Expr;
export declare function cols(col: string, ...cols2: string[]): Expr;
export declare function lit(value: any): Expr;

@@ -103,0 +103,0 @@ /**

@@ -50,3 +50,3 @@ "use strict";

let start = 0;
let len = _s.len();
const len = _s.len();
while (start < len) {

@@ -110,3 +110,3 @@ const v = _s.getIdx(start);

if (typeof reverse === "boolean") {
return _Series(_s.argsort(reverse, nullsLast));
return _Series(_s.argsort(reverse, nullsLast, false));
}

@@ -668,3 +668,3 @@ return _Series(_s.argsort(reverse.reverse, reverse.nullsLast ?? nullsLast));

exports._Series = _Series;
let SeriesConstructor = function (arg0, arg1, dtype, strict) {
const SeriesConstructor = function (arg0, arg1, dtype, strict) {
if (typeof arg0 === "string") {

@@ -671,0 +671,0 @@ const _s = (0, construction_1.arrayToJsSeries)(arg0, arg1, dtype, strict);

import { Series } from ".";
import { ListFunctions } from "../shared_traits";
export interface ListNamespace extends ListFunctions<Series> {
}
export type ListNamespace = ListFunctions<Series>;
export declare const SeriesListFunctions: (_s: any) => ListFunctions<Series>;

@@ -30,3 +30,3 @@ "use strict";

contains(pat) {
return wrap("strContains", (0, utils_1.regexToString)(pat));
return wrap("strContains", (0, utils_1.regexToString)(pat), false);
},

@@ -33,0 +33,0 @@ decode(arg, strict = false) {

/// <reference types="node" />
import { ColumnsOrExpr } from "./utils";
import { ColumnsOrExpr, StartBy } from "./utils";
import { Expr } from "./lazy/expr";

@@ -1119,3 +1119,4 @@ import { InterpolationMethod, RollingOptions, RollingQuantileOptions, RollingSkewOptions } from "./types";

by?: ColumnsOrExpr;
start_by: StartBy;
}): T;
}

@@ -14,2 +14,3 @@ import { Expr } from "./lazy/expr";

export type ExprOrString = Expr | string;
export type StartBy = "window" | "datapoint" | "monday";
/** @ignore */

@@ -16,0 +17,0 @@ export declare function columnOrColumns(columns: ColumnSelection | string | Array<string> | undefined): Array<string> | undefined;

{
"name": "nodejs-polars",
"version": "0.7.4",
"version": "0.8.0",
"repository": "https://github.com/pola-rs/nodejs-polars.git",

@@ -49,3 +49,3 @@ "license": "SEE LICENSE IN LICENSE",

"format:rs": "cargo fmt",
"lint:ts:fix": "rome check --apply-suggested {polars,__tests__} && rome format --write {polars,__tests__}",
"lint:ts:fix": "rome check --apply-unsafe {polars,__tests__} && rome format --write {polars,__tests__}",
"lint:ts": "rome check {polars,__tests__} && rome format {polars,__tests__}",

@@ -59,14 +59,14 @@ "lint": "yarn lint:ts && yarn format:rs",

"devDependencies": {
"@napi-rs/cli": "^2.14.1",
"@napi-rs/cli": "^2.16.1",
"@types/chance": "^1.1.3",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.9",
"chance": "^1.1.8",
"jest": "^27.3.1",
"rome": "^11.0.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.2.5",
"chance": "^1.1.11",
"jest": "^29.5.0",
"rome": "^12.1.3",
"source-map-support": "^0.5.21",
"ts-jest": "^27.1.0",
"ts-node": "^10.4.0",
"typedoc": "^0.23",
"typescript": "4.9"
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typedoc": "^0.24.7",
"typescript": "5.1.3"
},

@@ -78,12 +78,12 @@ "packageManager": "yarn@3.3.1",

"optionalDependencies": {
"nodejs-polars-win32-x64-msvc": "0.7.4",
"nodejs-polars-darwin-x64": "0.7.4",
"nodejs-polars-linux-x64-gnu": "0.7.4",
"nodejs-polars-darwin-arm64": "0.7.4",
"nodejs-polars-linux-arm64-gnu": "0.7.4",
"nodejs-polars-linux-arm64-musl": "0.7.4",
"nodejs-polars-android-arm64": "0.7.4",
"nodejs-polars-win32-ia32-msvc": "0.7.4",
"nodejs-polars-linux-x64-musl": "0.7.4"
"nodejs-polars-win32-x64-msvc": "0.8.0",
"nodejs-polars-darwin-x64": "0.8.0",
"nodejs-polars-linux-x64-gnu": "0.8.0",
"nodejs-polars-darwin-arm64": "0.8.0",
"nodejs-polars-linux-arm64-gnu": "0.8.0",
"nodejs-polars-linux-arm64-musl": "0.8.0",
"nodejs-polars-android-arm64": "0.8.0",
"nodejs-polars-win32-ia32-msvc": "0.8.0",
"nodejs-polars-linux-x64-musl": "0.8.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc