nodejs-polars
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -1430,15 +1430,11 @@ /// <reference types="node" /> | ||
(): DataFrame; | ||
(data: Record<string, any>[]): DataFrame; | ||
(data: Series<any>[]): DataFrame; | ||
(data: any): DataFrame; | ||
(data: any[][], options: { | ||
(data: any, options?: { | ||
columns?: any[]; | ||
orient?: "row" | "col"; | ||
schema?: Record<string, string | DataType>; | ||
inferSchemaLength?: number; | ||
}): DataFrame; | ||
isDataFrame(arg: any): arg is DataFrame; | ||
} | ||
export declare namespace pl { | ||
const DataFrame: DataFrameConstructor; | ||
} | ||
export declare const DataFrame: DataFrameConstructor; | ||
export {}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DataFrame = exports.pl = exports.dfWrapper = void 0; | ||
exports.DataFrame = exports.dfWrapper = void 0; | ||
const polars_internal_1 = __importDefault(require("./internals/polars_internal")); | ||
@@ -559,3 +559,3 @@ const construction_1 = require("./internals/construction"); | ||
if (Array.isArray(data)) { | ||
return (0, exports.dfWrapper)((0, construction_1.arrayToJsDataFrame)(data, options?.columns, options?.orient)); | ||
return (0, exports.dfWrapper)((0, construction_1.arrayToJsDataFrame)(data, options)); | ||
} | ||
@@ -574,6 +574,2 @@ return (0, exports.dfWrapper)(objToDF(data)); | ||
const isDataFrame = (ty) => (0, types_1.isExternal)(ty?._df); | ||
var pl; | ||
(function (pl) { | ||
pl.DataFrame = Object.assign(DataFrameConstructor, { isDataFrame }); | ||
})(pl = exports.pl || (exports.pl = {})); | ||
exports.DataFrame = Object.assign(DataFrameConstructor, { isDataFrame }); |
@@ -7,2 +7,2 @@ import { DataType } from "../datatypes"; | ||
export declare function arrayToJsSeries(name: string, values: any[], dtype?: any, strict?: boolean): any; | ||
export declare function arrayToJsDataFrame(data: any[], columns?: string[], orient?: "col" | "row", typedArrays?: boolean): any; | ||
export declare function arrayToJsDataFrame(data: any[], options?: any): any; |
@@ -122,3 +122,5 @@ "use strict"; | ||
exports.arrayToJsSeries = arrayToJsSeries; | ||
function arrayToJsDataFrame(data, columns, orient, typedArrays) { | ||
function arrayToJsDataFrame(data, options) { | ||
let columns = options?.columns; | ||
let orient = options?.orient; | ||
let dataSeries; | ||
@@ -138,3 +140,3 @@ if (!data.length) { | ||
else if (data[0].constructor.name === "Object") { | ||
const df = polars_internal_1.default.df.read_rows({ rows: data }); | ||
const df = polars_internal_1.default.df.read_rows({ rows: data, ...options }); | ||
if (columns) { | ||
@@ -155,10 +157,3 @@ polars_internal_1.default.df.set_column_names({ _df: df, names: columns }); | ||
else { | ||
if (typedArrays) { | ||
dataSeries = data.map((s, idx) => series_1.Series.from(s) | ||
.as(`column_${idx}`) | ||
.inner()); | ||
} | ||
else { | ||
dataSeries = data.map((s, idx) => (0, series_1.Series)(`column_${idx}`, s).inner()); | ||
} | ||
dataSeries = data.map((s, idx) => (0, series_1.Series)(`column_${idx}`, s).inner()); | ||
} | ||
@@ -165,0 +160,0 @@ } |
@@ -522,4 +522,9 @@ import { DataType } from "../datatypes"; | ||
takeEvery(n: number): Expr; | ||
/** Get the unique/distinct values in the list */ | ||
unique(): Expr; | ||
/** | ||
* Get the unique/distinct values in the list | ||
* @param maintainOrder Maintain order of data. This requires more work. | ||
*/ | ||
unique(maintainOrder?: boolean | { | ||
maintainOrder: boolean; | ||
}): Expr; | ||
/** Returns a unit Series with the highest value possible for the dtype of this expression. */ | ||
@@ -526,0 +531,0 @@ upperBound(): Expr; |
@@ -263,3 +263,8 @@ "use strict"; | ||
takeEvery: wrapUnary("takeEvery", "n"), | ||
unique: wrapNullArgs("unique"), | ||
unique(opt) { | ||
if (opt) { | ||
return wrap("unique_stable"); | ||
} | ||
return wrap("unique"); | ||
}, | ||
upperBound: wrapNullArgs("upperBound"), | ||
@@ -266,0 +271,0 @@ where: wrapExprArg("filter"), |
{ | ||
"name": "nodejs-polars", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"repository": "https://github.com/pola-rs/polars.git", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE", |
@@ -938,2 +938,3 @@ import { DataType, DtypeToPrimitive, Optional } from "../datatypes"; | ||
* ___ | ||
* @param maintainOrder Maintain order of data. This requires more work. | ||
* @example | ||
@@ -952,24 +953,26 @@ * ``` | ||
*/ | ||
unique(): Series<T>; | ||
unique(maintainOrder?: boolean | { | ||
maintainOrder: boolean; | ||
}): Series<T>; | ||
/** | ||
* __Count the unique values in a Series.__ | ||
* ___ | ||
* @example | ||
* ``` | ||
* s = pl.Series("a", [1, 2, 2, 3]) | ||
* s.valueCounts() | ||
* shape: (3, 2) | ||
* ╭─────┬────────╮ | ||
* │ a ┆ counts │ | ||
* │ --- ┆ --- │ | ||
* │ i64 ┆ u32 │ | ||
* ╞═════╪════════╡ | ||
* │ 2 ┆ 2 │ | ||
* ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ | ||
* │ 1 ┆ 1 │ | ||
* ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ | ||
* │ 3 ┆ 1 │ | ||
* ╰─────┴────────╯ | ||
* ``` | ||
*/ | ||
* __Count the unique values in a Series.__ | ||
* ___ | ||
* @example | ||
* ``` | ||
* s = pl.Series("a", [1, 2, 2, 3]) | ||
* s.valueCounts() | ||
* shape: (3, 2) | ||
* ╭─────┬────────╮ | ||
* │ a ┆ counts │ | ||
* │ --- ┆ --- │ | ||
* │ i64 ┆ u32 │ | ||
* ╞═════╪════════╡ | ||
* │ 2 ┆ 2 │ | ||
* ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ | ||
* │ 1 ┆ 1 │ | ||
* ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ | ||
* │ 3 ┆ 1 │ | ||
* ╰─────┴────────╯ | ||
* ``` | ||
*/ | ||
valueCounts(): DataFrame; | ||
@@ -1009,3 +1012,3 @@ /** | ||
* const s = pl.Series("foo", [1,2,3]) | ||
* s.toJS() | ||
* s.toObject() | ||
* { | ||
@@ -1012,0 +1015,0 @@ * name: "foo", |
@@ -557,3 +557,10 @@ "use strict"; | ||
toObject: noArgUnwrap("to_js"), | ||
unique: noArgWrap("unique"), | ||
unique(opt) { | ||
if (opt) { | ||
return wrap("unique_stable"); | ||
} | ||
else { | ||
return wrap("unique"); | ||
} | ||
}, | ||
valueCounts() { | ||
@@ -560,0 +567,0 @@ return (0, dataframe_1.dfWrapper)(unwrap("value_counts")); |
{ | ||
"name": "nodejs-polars", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"repository": "https://github.com/pola-rs/polars.git", | ||
@@ -89,14 +89,14 @@ "license": "SEE LICENSE IN LICENSE", | ||
"optionalDependencies": { | ||
"nodejs-polars-win32-x64-msvc": "0.3.0", | ||
"nodejs-polars-darwin-x64": "0.3.0", | ||
"nodejs-polars-linux-x64-gnu": "0.3.0", | ||
"nodejs-polars-win32-ia32-msvc": "0.3.0", | ||
"nodejs-polars-linux-arm64-gnu": "0.3.0", | ||
"nodejs-polars-linux-arm-gnueabihf": "0.3.0", | ||
"nodejs-polars-darwin-arm64": "0.3.0", | ||
"nodejs-polars-android-arm64": "0.3.0", | ||
"nodejs-polars-linux-x64-musl": "0.3.0", | ||
"nodejs-polars-linux-arm64-musl": "0.3.0", | ||
"nodejs-polars-win32-arm64-msvc": "0.3.0" | ||
"nodejs-polars-win32-x64-msvc": "0.3.1", | ||
"nodejs-polars-darwin-x64": "0.3.1", | ||
"nodejs-polars-linux-x64-gnu": "0.3.1", | ||
"nodejs-polars-win32-ia32-msvc": "0.3.1", | ||
"nodejs-polars-linux-arm64-gnu": "0.3.1", | ||
"nodejs-polars-linux-arm-gnueabihf": "0.3.1", | ||
"nodejs-polars-darwin-arm64": "0.3.1", | ||
"nodejs-polars-android-arm64": "0.3.1", | ||
"nodejs-polars-linux-x64-musl": "0.3.1", | ||
"nodejs-polars-linux-arm64-musl": "0.3.1", | ||
"nodejs-polars-win32-arm64-msvc": "0.3.1" | ||
} | ||
} |
@@ -113,7 +113,8 @@ # Polars | ||
### Minimum Requirements | ||
- Node version `>=16` | ||
- Rust version `>=1.59` - *Only needed for development* | ||
___ | ||
#### Rust version | ||
Required Rust version `>=1.52` | ||
## Documentation | ||
@@ -120,0 +121,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
330728
8687
169