df-script 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -34
- package/dist/api.d.ts +16 -8
- package/dist/api.js +11 -3
- package/dist/columnExpressions/ColumnExpr.d.ts +26 -364
- package/dist/columnExpressions/ColumnExpr.js +199 -3
- package/dist/columnExpressions/ExprBase.d.ts +8 -11
- package/dist/columnExpressions/ExprBase.js +20 -61
- package/dist/columnExpressions/constants.d.ts +2 -0
- package/dist/columnExpressions/constants.js +3 -1
- package/dist/columnExpressions/functions/coalesce.js +8 -4
- package/dist/columnExpressions/functions/element.d.ts +5 -0
- package/dist/columnExpressions/functions/element.js +11 -0
- package/dist/columnExpressions/functions/implode.d.ts +3 -0
- package/dist/columnExpressions/functions/implode.js +7 -0
- package/dist/columnExpressions/functions/lit.d.ts +3 -1
- package/dist/columnExpressions/functions/lit.js +8 -13
- package/dist/columnExpressions/functions/repeat.d.ts +47 -0
- package/dist/columnExpressions/functions/repeat.js +131 -0
- package/dist/columnExpressions/functions/seq_range.d.ts +31 -0
- package/dist/columnExpressions/functions/seq_range.js +91 -0
- package/dist/columnExpressions/functions/when.js +8 -4
- package/dist/columnExpressions/index.d.ts +5 -2
- package/dist/columnExpressions/index.js +5 -48
- package/dist/columnExpressions/mixins/AggregationExpr.d.ts +25 -50
- package/dist/columnExpressions/mixins/AggregationExpr.js +69 -165
- package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +41 -66
- package/dist/columnExpressions/mixins/ArithmeticExpr.js +126 -138
- package/dist/columnExpressions/mixins/BooleanExpr.d.ts +40 -0
- package/dist/columnExpressions/mixins/BooleanExpr.js +67 -0
- package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +31 -60
- package/dist/columnExpressions/mixins/ComparisonExpr.js +231 -370
- package/dist/columnExpressions/mixins/ListExpr.d.ts +15 -39
- package/dist/columnExpressions/mixins/ListExpr.js +124 -148
- package/dist/columnExpressions/mixins/LogicalExpr.d.ts +7 -33
- package/dist/columnExpressions/mixins/LogicalExpr.js +48 -49
- package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +6 -31
- package/dist/columnExpressions/mixins/ManipulationExpr.js +61 -25
- package/dist/columnExpressions/mixins/NumericExpr.d.ts +92 -0
- package/dist/columnExpressions/mixins/NumericExpr.js +259 -0
- package/dist/columnExpressions/mixins/StringExpr.d.ts +5 -30
- package/dist/columnExpressions/mixins/StringExpr.js +37 -49
- package/dist/columnExpressions/mixins/StructExpr.d.ts +16 -0
- package/dist/columnExpressions/mixins/StructExpr.js +139 -0
- package/dist/columnExpressions/mixins/TemporalExpr.d.ts +4 -30
- package/dist/columnExpressions/mixins/TemporalExpr.js +28 -29
- package/dist/columnExpressions/mixins/WindowExpr.d.ts +27 -49
- package/dist/columnExpressions/mixins/WindowExpr.js +144 -274
- package/dist/columnExpressions/utils.d.ts +4 -0
- package/dist/columnExpressions/utils.js +45 -0
- package/dist/dataframe/constants.d.ts +3 -0
- package/dist/dataframe/constants.js +4 -1
- package/dist/dataframe/dataframe.d.ts +27 -10
- package/dist/dataframe/dataframe.js +461 -220
- package/dist/dataframe/grouped/grouped.d.ts +2 -3
- package/dist/dataframe/grouped/grouped.js +17 -16
- package/dist/dataframe/types.d.ts +65 -1
- package/dist/dataframe/utils.d.ts +11 -3
- package/dist/dataframe/utils.js +101 -9
- package/dist/datatypes/DataType.d.ts +2 -1
- package/dist/datatypes/DataType.js +29 -0
- package/dist/datatypes/index.d.ts +2 -2
- package/dist/datatypes/types.d.ts +37 -36
- package/dist/datatypes/types.js +15 -11
- package/dist/exceptions/index.d.ts +2 -0
- package/dist/exceptions/index.js +4 -1
- package/dist/exceptions/utils.d.ts +1 -0
- package/dist/exceptions/utils.js +19 -0
- package/dist/functions/concat.d.ts +1 -2
- package/dist/functions/concat.js +24 -12
- package/dist/functions/index.d.ts +3 -1
- package/dist/functions/index.js +7 -15
- package/dist/functions/read_csv.d.ts +8 -0
- package/dist/functions/read_csv.js +53 -0
- package/dist/functions/read_json.d.ts +10 -0
- package/dist/functions/read_json.js +21 -0
- package/dist/functions/transpose.d.ts +7 -0
- package/dist/functions/transpose.js +84 -0
- package/dist/index.js +6 -1
- package/dist/types.d.ts +31 -5
- package/dist/utils/csv.d.ts +77 -0
- package/dist/utils/csv.js +313 -0
- package/dist/utils/date.js +5 -6
- package/dist/utils/guards.d.ts +0 -2
- package/dist/utils/guards.js +0 -31
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/json.d.ts +120 -2
- package/dist/utils/json.js +204 -20
- package/dist/utils/list.d.ts +173 -1
- package/dist/utils/list.js +255 -22
- package/dist/utils/number.d.ts +61 -28
- package/dist/utils/number.js +248 -70
- package/dist/utils/string.d.ts +5 -0
- package/dist/utils/string.js +89 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# 🚀 DFScript
|
|
2
2
|
|
|
3
|
+
[](DONATIONS.md)
|
|
4
|
+
|
|
3
5
|
DFScript is a lightweight, high-performance, and **zero-dependency** data analysis library for TypeScript and JavaScript. Heavily inspired by modern dataframe libraries like **Polars** and **Pandas**, DFScript brings a robust, expression-based columnar data processing engine directly to the JavaScript ecosystem.
|
|
4
6
|
|
|
5
7
|
With optimized columnar storage under the hood, DFScript enables you to build clean, maintainable, and type-safe data pipelines using a declarative expression API.
|
|
@@ -21,6 +23,18 @@ With optimized columnar storage under the hood, DFScript enables you to build cl
|
|
|
21
23
|
|
|
22
24
|
---
|
|
23
25
|
|
|
26
|
+
## ⚙️ Compatibility & Design Principles
|
|
27
|
+
|
|
28
|
+
DFScript is designed with a **low-abstraction, zero-dependency** philosophy to guarantee maximum compatibility, predictability, and runtime performance:
|
|
29
|
+
|
|
30
|
+
- 📦 **Zero External Dependencies** — Lightweight footprint with zero runtime overhead or supply chain vulnerabilities.
|
|
31
|
+
- 🌐 **Universal Compatibility** — Works out-of-the-box in any JavaScript/TypeScript environment, including Node.js, Deno, Bun, web browsers, and cloud/edge workers.
|
|
32
|
+
- 🧱 **Built-in Standards** — Prioritizes native, built-in APIs (like standard `Date`, `Intl` formatting, and `TextEncoder`) and standard arrays rather than custom wrappers or heavy runtime abstractions.
|
|
33
|
+
- ⚡ **Optimized Execution Paths** — Under the hood, performance-critical code avoids higher-level array iterators and short-lived intermediate allocations in favor of simple, fast `for` and `while` loops with cached lengths, keeping garbage collection overhead to an absolute minimum.
|
|
34
|
+
- 🔄 **Easy Transpilation** — Relies strictly on low-level native operations, making it fully compatible with older environments (like ES6 or even ES5) without requiring complex polyfills or modern engine-specific features.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
24
38
|
## 📦 Installation
|
|
25
39
|
|
|
26
40
|
Install DFScript using your favorite package manager:
|
|
@@ -43,10 +57,10 @@ pnpm add df-script
|
|
|
43
57
|
Here is a quick example showing how to load data, run expressions, perform aggregations, and compute rolling statistics.
|
|
44
58
|
|
|
45
59
|
```typescript
|
|
46
|
-
import { $
|
|
60
|
+
import { $df } from "df-script";
|
|
47
61
|
|
|
48
62
|
// 1. Create a DataFrame with structured data and automatic schema inference
|
|
49
|
-
const df = $
|
|
63
|
+
const df = $df.data([
|
|
50
64
|
{ id: 1, name: "Alice", join_date: "2026-01-15", sales: 1200.50, tags: ["sales", "east"] },
|
|
51
65
|
{ id: 2, name: "Bob", join_date: "2026-02-20", sales: 850.00, tags: ["support", "west"] },
|
|
52
66
|
{ id: 3, name: "Charlie", join_date: "2026-03-05", sales: 2300.00, tags: ["sales", "north"] },
|
|
@@ -55,11 +69,11 @@ const df = $tbl.data([
|
|
|
55
69
|
|
|
56
70
|
// 2. Select columns, transform strings, format dates, and fill missing values
|
|
57
71
|
const processedDf = df.select(
|
|
58
|
-
$
|
|
59
|
-
$
|
|
60
|
-
$
|
|
61
|
-
$
|
|
62
|
-
$
|
|
72
|
+
$df.col("id"),
|
|
73
|
+
$df.col("name").str.upper().alias("NAME_UPPER"),
|
|
74
|
+
$df.col("join_date").str.to_datetime().dt.year().alias("join_year"),
|
|
75
|
+
$df.col("sales").add(500).alias("sales_adjusted"),
|
|
76
|
+
$df.col("tags").list.lengths().alias("tag_count")
|
|
63
77
|
);
|
|
64
78
|
|
|
65
79
|
console.log(processedDf.to_dicts());
|
|
@@ -77,14 +91,15 @@ console.log(processedDf.to_dicts());
|
|
|
77
91
|
|
|
78
92
|
## 📖 Core Concepts
|
|
79
93
|
|
|
80
|
-
### The `$
|
|
94
|
+
### The `$df` Entry Point
|
|
81
95
|
|
|
82
|
-
DFScript uses the `$
|
|
96
|
+
DFScript uses the `$df` namespace to bootstrap DataFrames, refer to columns, and access general types.
|
|
83
97
|
|
|
84
|
-
- `$
|
|
85
|
-
- `$
|
|
86
|
-
- `$
|
|
87
|
-
- `$
|
|
98
|
+
- `$df.data(dataRowsOrCols, schema?)`: Instantiates a new `DataFrame`.
|
|
99
|
+
- `$df.read_json(content, options?)`: Reads JSON/NDJSON content into a new `DataFrame`.
|
|
100
|
+
- `$df.col(name)`: Creates a column reference expression.
|
|
101
|
+
- `$df.all()`: Selects all columns in the DataFrame.
|
|
102
|
+
- `$df.DataType`: Direct access to the `DataTypeRegistry` for schema specification.
|
|
88
103
|
|
|
89
104
|
### DataFrames vs. Columns
|
|
90
105
|
|
|
@@ -96,7 +111,7 @@ DFScript uses the `$tbl` namespace to bootstrap DataFrames, refer to columns, an
|
|
|
96
111
|
## 🛠️ DataFrame API Reference
|
|
97
112
|
|
|
98
113
|
### 1. Transformations & Projection
|
|
99
|
-
- **`select(...exprs)`**: Projects columns. Supports strings, raw column names, `$
|
|
114
|
+
- **`select(...exprs)`**: Projects columns. Supports strings, raw column names, `$df.col(...)` expressions, and `$df.all()`.
|
|
100
115
|
- **`with_columns(...exprs)`**: Adds or overrides columns. Accepts expressions, strings, or options objects mapping keys to values/expressions.
|
|
101
116
|
- **`drop(...names)`**: Drops one or more columns from the DataFrame.
|
|
102
117
|
- **`rename(mapping)`**: Renames columns using a `{ oldName: newName }` object.
|
|
@@ -107,13 +122,14 @@ DFScript uses the `$tbl` namespace to bootstrap DataFrames, refer to columns, an
|
|
|
107
122
|
- **`limit(n, options?)`**: Returns the first `n` rows. Options include `offset` and direction `from: "start" | "end"`.
|
|
108
123
|
- **`head(n)`** / **`tail(n)`**: Shortcuts for `limit` from the start or end of the DataFrame.
|
|
109
124
|
- **`slice(start, end?)`**: Extract a subset of rows using standard index slicing.
|
|
125
|
+
- **`gather(indices, options?)`**: Gathers rows at specified indices. Supports single index, arrays of indices, and negative indexing. Options include `{ null_on_oob?: boolean }` (default: `false` which throws an error on out-of-bounds indices; if `true`, out-of-bounds indices result in `null` values).
|
|
110
126
|
|
|
111
127
|
### 3. Sorting
|
|
112
128
|
- **`sort({ by, descending?, nullsLast?, custom? })`**: Sorts rows. Supports single or multiple columns/expressions, custom descending configurations per column, custom null sorting rules, and custom comparator functions.
|
|
113
129
|
|
|
114
130
|
### 4. Grouping & Aggregations
|
|
115
131
|
- **`groupby(keys)`**: Groups the data by one or more columns, returning a `GroupedData` object.
|
|
116
|
-
- **`GroupedData.agg(...exprs)`**: Run aggregations on grouped data (e.g. `$
|
|
132
|
+
- **`GroupedData.agg(...exprs)`**: Run aggregations on grouped data (e.g. `$df.col("sales").sum()`).
|
|
117
133
|
|
|
118
134
|
### 5. Reshaping & Joining
|
|
119
135
|
- **`join(other, on, how, suffixes?)`**: Merges two DataFrames on join keys. Supported join types: `"inner" | "left" | "right" | "outer"`.
|
|
@@ -123,6 +139,39 @@ DFScript uses the `$tbl` namespace to bootstrap DataFrames, refer to columns, an
|
|
|
123
139
|
|
|
124
140
|
---
|
|
125
141
|
|
|
142
|
+
## 📂 File / Data I/O
|
|
143
|
+
|
|
144
|
+
DFScript provides helpers to serialize and parse data formats like JSON and CSV.
|
|
145
|
+
|
|
146
|
+
### Reading Data
|
|
147
|
+
- **`$df.read_json(content, options?)`**: Reads a JSON array or Newline Delimited JSON (NDJSON) string and loads it into a new DataFrame.
|
|
148
|
+
```typescript
|
|
149
|
+
import { $df } from "df-script";
|
|
150
|
+
|
|
151
|
+
// Read standard JSON array
|
|
152
|
+
const df = $df.read_json('[{"id": 1, "name": "Alice"}]');
|
|
153
|
+
|
|
154
|
+
// Read Newline Delimited JSON (NDJSON)
|
|
155
|
+
const dfNdjson = $df.read_json('{"id": 1}\n{"id": 2}', { format: "ndjson" });
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Writing Data
|
|
159
|
+
- **`df.write_json(file?, options?)`**: Serializes a DataFrame into a JSON or NDJSON string. If a file path or writable stream/object (with a `.write` method) is provided, writes/streams the content as a side-effect. Always returns the serialized string.
|
|
160
|
+
```typescript
|
|
161
|
+
// Write to a file and get the string
|
|
162
|
+
const jsonStr = df.write_json("output.json");
|
|
163
|
+
```
|
|
164
|
+
- **`df.write_csv(file?, options?)`**: Serializes a DataFrame into a CSV string. Supports options for headers, custom separators, quote styles, float precision, and BOM. If a file path or writable stream/object (with a `.write` method) is provided, writes/streams the content as a side-effect. Always returns the serialized string.
|
|
165
|
+
```typescript
|
|
166
|
+
// Serialize to a CSV string
|
|
167
|
+
const csvStr = df.write_csv();
|
|
168
|
+
|
|
169
|
+
// Write to a file with custom separator
|
|
170
|
+
df.write_csv("output.csv", { separator: ";" });
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
126
175
|
## 🧮 Expressions API Reference
|
|
127
176
|
|
|
128
177
|
All column expressions inherit from `ExprBase` and support standard operators.
|
|
@@ -157,18 +206,18 @@ To maintain a clean and uncluttered API namespace, specific data transforms are
|
|
|
157
206
|
### 🔤 String Operations (`.str`)
|
|
158
207
|
Available on any expression via `.str`:
|
|
159
208
|
```typescript
|
|
160
|
-
$
|
|
161
|
-
$
|
|
162
|
-
$
|
|
209
|
+
$df.col("name").str.lower()
|
|
210
|
+
$df.col("code").str.starts_with("A")
|
|
211
|
+
$df.col("description").str.replace(/foo/i, "bar")
|
|
163
212
|
```
|
|
164
213
|
- **Methods**: `lower()`, `upper()`, `len()`, `len_bytes()`, `len_chars()`, `trim()`, `trim_start()`, `trim_end()`, `starts_with(prefix)`, `ends_with(suffix)`, `contains(pattern)`, `replace(pattern, repl)`, `replace_all(pattern, repl)`, `slice(offset, length?)`, `split(delimiter)`, `explode()`, `reverse()`, `lpad(w, f)`, `rpad(w, f)`, `zfill(w)`, `strip_chars(chars?)`, `strip_chars_start(chars?)`, `strip_chars_end(chars?)`, `strip_prefix(pfx)`, `strip_suffix(sfx)`, `to_titlecase()`, `strptime(format, strict?)`, `to_integer()`, `to_decimal(p, s)`, `to_date()`, `to_datetime()`, `to_time()`.
|
|
165
214
|
|
|
166
215
|
### 📅 Temporal Operations (`.dt`)
|
|
167
216
|
Available on datetime or duration values via `.dt`:
|
|
168
217
|
```typescript
|
|
169
|
-
$
|
|
170
|
-
$
|
|
171
|
-
$
|
|
218
|
+
$df.col("timestamp").dt.year()
|
|
219
|
+
$df.col("timestamp").dt.strftime("%Y-%m-%d %H:%M:%S")
|
|
220
|
+
$df.col("duration").dt.total_seconds()
|
|
172
221
|
```
|
|
173
222
|
- **Datetime Methods**: `year()`, `month()`, `day()`, `hour()`, `minute()`, `second()`, `millisecond()`, `microsecond()`, `nanosecond()`, `weekday()`, `week()`, `quarter()`, `century()`, `millennium()`, `ordinal_day()`, `is_leap_year()`, `month_start()`, `month_end()`, `date()`, `time()`, `datetime()`, `epoch(unit)`, `timestamp(unit)`, `strftime(format, locale?)`.
|
|
174
223
|
- **Duration Methods**: `total_days()`, `total_hours()`, `total_minutes()`, `total_seconds()`, `total_milliseconds()`, `total_microseconds()`, `total_nanoseconds()`.
|
|
@@ -176,8 +225,8 @@ $tbl.col("duration").dt.total_seconds()
|
|
|
176
225
|
### 📊 List Operations (`.list`)
|
|
177
226
|
Available on arrays or lists via `.list`:
|
|
178
227
|
```typescript
|
|
179
|
-
$
|
|
180
|
-
$
|
|
228
|
+
$df.col("tags").list.contains("vip")
|
|
229
|
+
$df.col("matrix").list.get(2)
|
|
181
230
|
```
|
|
182
231
|
- **Methods**: `lengths()`, `len()`, `get(idx, null_on_oob?)`, `first(null_on_oob?)`, `last(null_on_oob?)`, `gather(indices, null_on_oob?)`, `gather_every(n, offset?)`, `slice(offset, length?)`, `contains(item)`, `count_matches(item)`, `join(separator)`, `sort(descending?)`, `reverse()`, `unique()`, `sum()`, `mean()`, `median()`, `mode()`, `min()`, `max()`.
|
|
183
232
|
|
|
@@ -190,11 +239,11 @@ DFScript provides full support for analytic partition window operations using `.
|
|
|
190
239
|
```typescript
|
|
191
240
|
// Calculate partition cumulative sums and row numbers
|
|
192
241
|
df.select(
|
|
193
|
-
$
|
|
194
|
-
$
|
|
195
|
-
$
|
|
196
|
-
$
|
|
197
|
-
$
|
|
242
|
+
$df.col("department"),
|
|
243
|
+
$df.col("sales"),
|
|
244
|
+
$df.col("sales").sum().over("department").alias("dept_total_sales"),
|
|
245
|
+
$df.col("sales").cum_sum().over("department").alias("dept_running_sales"),
|
|
246
|
+
$df.all().row_number().over("department").alias("dept_rank")
|
|
198
247
|
);
|
|
199
248
|
```
|
|
200
249
|
|
|
@@ -230,16 +279,16 @@ Apply moving calculations over a fixed window size:
|
|
|
230
279
|
You can optionally declare schemas to enforce precise data types and automatic type coercion during construction.
|
|
231
280
|
|
|
232
281
|
```typescript
|
|
233
|
-
import { $
|
|
282
|
+
import { $df } from "df-script";
|
|
234
283
|
|
|
235
284
|
const schema = {
|
|
236
|
-
id: $
|
|
237
|
-
price: $
|
|
238
|
-
active: $
|
|
239
|
-
created_at: $
|
|
285
|
+
id: $df.DataType.Int32,
|
|
286
|
+
price: $df.DataType.Decimal(10, 2),
|
|
287
|
+
active: $df.DataType.Boolean,
|
|
288
|
+
created_at: $df.DataType.Datetime
|
|
240
289
|
};
|
|
241
290
|
|
|
242
|
-
const df = $
|
|
291
|
+
const df = $df.data(rawData, schema);
|
|
243
292
|
```
|
|
244
293
|
|
|
245
294
|
### Supported Data Types
|
package/dist/api.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { DataFrame } from "./dataframe";
|
|
2
|
-
import { ColumnExpr, lit, all, exclude, coalesce, when } from "./columnExpressions";
|
|
2
|
+
import { ColumnExpr, lit, all, exclude, coalesce, when, implode, seq_range, element } from "./columnExpressions";
|
|
3
3
|
import { DataType } from "./datatypes";
|
|
4
|
-
import { concat } from "./functions";
|
|
5
|
-
import type { RowRecord } from "./types";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { concat, read_json, read_csv } from "./functions";
|
|
5
|
+
import type { RowRecord, DataFrameSchema, ColumnDict, InferSchema } from "./types";
|
|
6
|
+
declare function data<S extends DataFrameSchema>(data: any[] | ColumnDict, schema: S): DataFrame<InferSchema<S>>;
|
|
7
|
+
declare function data<T extends RowRecord = any>(data: T[] | ColumnDict, schema?: DataFrameSchema): DataFrame<T>;
|
|
8
|
+
export declare const $df: {
|
|
9
|
+
data: typeof data;
|
|
10
|
+
col: <T = any>(name: keyof T | string | (keyof T | string)[] | DataType | Function | (DataType | Function)[]) => ColumnExpr<T>;
|
|
9
11
|
all: typeof all;
|
|
10
12
|
exclude: typeof exclude;
|
|
11
13
|
coalesce: typeof coalesce;
|
|
12
14
|
concat: typeof concat;
|
|
15
|
+
read_json: typeof read_json;
|
|
16
|
+
read_csv: typeof read_csv;
|
|
13
17
|
lit: typeof lit;
|
|
14
18
|
when: typeof when;
|
|
19
|
+
implode: typeof implode;
|
|
20
|
+
seq_range: typeof seq_range;
|
|
21
|
+
element: typeof element;
|
|
15
22
|
DataType: {
|
|
16
23
|
Int8: import("./datatypes").Int8Type;
|
|
17
24
|
Int16: import("./datatypes").Int16Type;
|
|
@@ -33,7 +40,8 @@ export declare const $tbl: {
|
|
|
33
40
|
Duration: import("./datatypes").DurationType;
|
|
34
41
|
Object: import("./datatypes").ObjectType;
|
|
35
42
|
Null: import("./datatypes").NullType;
|
|
36
|
-
List: <TInner>(inner: DataType<TInner>) => import("./datatypes").ListType<TInner>;
|
|
37
|
-
Struct: <TFields extends RowRecord>(fields: { [K in keyof TFields]: DataType<TFields[K]>; }) => import("./datatypes").StructType<TFields>;
|
|
43
|
+
List: <TInner>(inner: import("./datatypes").RegisteredDataType & DataType<TInner>) => import("./datatypes").ListType<TInner>;
|
|
44
|
+
Struct: <TFields extends RowRecord>(fields: { [K in keyof TFields]: import("./datatypes").RegisteredDataType & DataType<TFields[K]>; }) => import("./datatypes").StructType<TFields>;
|
|
38
45
|
};
|
|
39
46
|
};
|
|
47
|
+
export {};
|
package/dist/api.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$
|
|
3
|
+
exports.$df = void 0;
|
|
4
4
|
const dataframe_1 = require("./dataframe");
|
|
5
5
|
const columnExpressions_1 = require("./columnExpressions");
|
|
6
6
|
const datatypes_1 = require("./datatypes");
|
|
7
7
|
const functions_1 = require("./functions");
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
function data(data, schema) {
|
|
9
|
+
return new dataframe_1.DataFrame(data, schema);
|
|
10
|
+
}
|
|
11
|
+
exports.$df = {
|
|
12
|
+
data,
|
|
10
13
|
col: (name) => new columnExpressions_1.ColumnExpr(name),
|
|
11
14
|
all: columnExpressions_1.all,
|
|
12
15
|
exclude: columnExpressions_1.exclude,
|
|
13
16
|
coalesce: columnExpressions_1.coalesce,
|
|
14
17
|
concat: functions_1.concat,
|
|
18
|
+
read_json: functions_1.read_json,
|
|
19
|
+
read_csv: functions_1.read_csv,
|
|
15
20
|
lit: columnExpressions_1.lit,
|
|
16
21
|
when: columnExpressions_1.when,
|
|
22
|
+
implode: columnExpressions_1.implode,
|
|
23
|
+
seq_range: columnExpressions_1.seq_range,
|
|
24
|
+
element: columnExpressions_1.element,
|
|
17
25
|
DataType: datatypes_1.DataTypeRegistry
|
|
18
26
|
};
|