Commit f3873fc
authored
feat: Adding series mapElements (#417)
Adding series mapElements to close #46
This feature will allow for DF column map thru series, for example:
```
const df = pl.DataFrame({ a: [1, 5, 3] });
const mapping: Record<number, number> = { 1: 11, 2: 22, 3: 33, 4: 44 };
const funcMap = (k: number): number => mapping[k] ?? '';
const mappedSeries: pl.Series = df.select(pl.col("a")).toSeries().mapElements(funcMap);
const df2 = df.withColumn(mappedSeries.alias("mappedSeries"));
```
Co-authored-by: Bidek56 <[email protected]>1 parent 8b01bbf commit f3873fc
2 files changed
+60
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
5 | 40 | | |
6 | 41 | | |
7 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
631 | 653 | | |
632 | 654 | | |
633 | 655 | | |
| |||
1612 | 1634 | | |
1613 | 1635 | | |
1614 | 1636 | | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
1615 | 1640 | | |
1616 | 1641 | | |
1617 | 1642 | | |
| |||
0 commit comments