Conversation
…n and removal
Add `src/core/insert_pop.ts` implementing four column manipulation utilities
that mirror pandas' DataFrame.insert() and DataFrame.pop():
- `insertColumn(df, loc, col, values)` — inserts a new column at integer position
`loc`, rebuilding the ordered column Map; raises RangeError on duplicate names
(unless allowDuplicates=true), out-of-range loc, or wrong value length
- `popColumn(df, col)` — removes and returns `{ series, df }` (immutable style)
- `reorderColumns(df, order)` — reorders/subsets columns (mirrors df[order])
- `moveColumn(df, col, newLoc)` — convenience wrapper: pop then re-insert
All operations are non-mutating (return new DataFrames). 40+ unit + 3
property-based tests. Interactive playground page: insert_pop.html.
Run: https://github.com/githubnext/tsessebe/actions/runs/24165728899
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- src/core/to_from_dict.ts: toDictOriented (7 orients: dict/columns/list/series/split/tight/records/index) + fromDictOriented (4 orients: columns/index/split/tight). Full TypeScript overloads with exact return types per orient string. - src/reshape/wide_to_long.ts: wideToLong() mirrors pandas.wide_to_long — collapses stub-prefixed column groups into rows. Supports sep, suffix regex, multiple id cols, alphabetic suffixes, and numeric suffix sorting. - Updated barrel exports: src/core/index.ts, src/reshape/index.ts, src/index.ts - Added tests/core/to_from_dict.test.ts (28 unit + 3 property tests) - Added tests/reshape/wide_to_long.test.ts (16 unit + 2 property tests) - Added playground/to_from_dict.html and playground/wide_to_long.html Metric: 29 → 31 pandas_features_ported (+2) Run: https://github.com/githubnext/tsessebe/actions/runs/24170164603 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 138 — ✅ Accepted
🤖 This PR is maintained by Autoloop. Each accepted iteration adds a commit to this branch. |
Implements pandas.cut and pandas.qcut as TypeScript equivalents:
- src/stats/cut_qcut.ts: cut() (fixed-width/explicit bins) and qcut() (quantile-based)
- tests/stats/cut_qcut.test.ts: 30+ unit tests + 2 property-based tests
- playground/cut_qcut.html: interactive tutorial page
Both functions return BinResult { codes, labels, bins }.
Options: labels (string[] | false), right, include_lowest, precision, duplicates.
Run: https://github.com/githubnext/tsessebe/actions/runs/24172139030
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 139 — ✅ Accepted Change: Added
Metric: 31 → 32 (+1) 🤖 This PR is maintained by Autoloop. Each accepted iteration adds a commit to this branch. |
Run: https://github.com/githubnext/tsessebe/actions/runs/24173724265 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 140 — ✅ Accepted
What was added
All functions share options: Tests: 35+ unit tests + 3 property-based tests (sem≥0, quantile monotonicity, output length invariant). |
Run: https://github.com/githubnext/tsessebe/actions/runs/24177038823 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 141 — ✅ Accepted
|
Added `src/stats/notna_isna.ts` — module-level missing-value utilities
mirroring pandas' `pd.isna()`, `pd.notna()`, `pd.isnull()`, `pd.notnull()`.
Functions work across all input types (scalar, array, Series, DataFrame):
- `isna` / `isnull` — detect null/undefined/NaN
- `notna` / `notnull` — inverse of isna
- `fillna(obj, {value})` — replace missing with fill value
- `dropna(obj, opts)` — remove missing; DataFrame supports how/axis
- `countna` / `countValid` — count missing / non-missing values
Tests: 50+ unit tests + 3 property-based tests (fast-check).
Playground: `playground/notna_isna.html`
Run: https://github.com/githubnext/tsessebe/actions/runs/24178594390
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add `src/window/rolling_apply.ts` — standalone rolling-window apply and
multi-aggregation module:
- `rollingApply(series, window, fn, opts)` — apply a custom function over
each window of a Series; supports `minPeriods`, `center`, and `raw` mode.
- `rollingAgg(series, window, namedFns, opts)` — apply multiple named
aggregation functions in one pass, returning a DataFrame keyed by name.
Mirrors `pandas.Rolling.agg({'mean': np.mean, 'std': np.std})`.
- `dataFrameRollingApply(df, window, fn, opts)` — apply custom function
per-column across a DataFrame.
- `dataFrameRollingAgg(df, window, namedFns, opts)` — multi-agg per-column,
producing columns named `{col}_{aggName}`.
Tests: 40+ unit tests + 3 property-based tests (fast-check). All pass.
Playground: `playground/rolling_apply.html` with interactive tutorial.
Run: https://github.com/githubnext/tsessebe/actions/runs/24182985389
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 143 — ✅ Accepted
What was addedFour new standalone functions:
These complement the existing
Tests: 40+ unit tests + 3 property-based tests (fast-check) Run: §24182985389 |
Added src/core/attrs.ts mirroring pandas' DataFrame.attrs / Series.attrs. Uses a WeakMap registry so immutable tsb objects can carry arbitrary key→value metadata without instance-property mutation. API: getAttrs, setAttrs, updateAttrs, withAttrs, copyAttrs, mergeAttrs, clearAttrs, hasAttrs, getAttr, setAttr, deleteAttr, attrsCount, attrsKeys. - src/core/attrs.ts — 13 exported functions + Attrs type alias - tests/core/attrs.test.ts — 40+ unit tests + 3 property-based tests (fast-check) - playground/attrs.html — interactive tutorial page with full API reference - src/core/index.ts — updated barrel exports - src/index.ts — re-exported from package root - playground/index.html — marked attrs as complete Run: https://github.com/githubnext/tsessebe/actions/runs/24196127191 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Iteration 144:
|
…ix/strRemoveSuffix/strTranslate/strCharWidth/strByteLength Add src/stats/string_ops.ts — 8 standalone string operation functions that complement the existing StringAccessor class: - strNormalize: Unicode normalization (NFC/NFD/NFKC/NFKD) - strGetDummies: split strings by delimiter → one-hot DataFrame - strExtractAll: extract all regex matches per element (JSON-encoded) - strRemovePrefix / strRemoveSuffix: strip leading/trailing affixes - strTranslate: character-level substitution via Map - strCharWidth: display width (CJK full-width chars count as 2) - strByteLength: UTF-8 encoded byte length 50+ unit tests + 5 property-based tests. Playground page string_ops.html. Metric: 37 → 38 (+1 exported source file). Run: https://github.com/githubnext/tsessebe/actions/runs/24203932812 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 145 — ✅ Accepted
Run: §24203932812 |
Added `src/core/pipe_apply.ts` — standalone pipe/apply functions: - `pipe` — variadic type-safe functional pipeline (8 overloads, works on any value) - `seriesApply` — element-wise apply with (value, label, position) context - `seriesTransform` — scalar→scalar element-wise transform - `dataFrameApply` — column-wise (axis=0) or row-wise (axis=1) aggregation → Series - `dataFrameApplyMap` — element-wise apply to every cell → DataFrame (pandas applymap) - `dataFrameTransform` — column-wise transform, each col → Series of same length - `dataFrameTransformRows` — row-wise transform, partial updates supported Also added 50+ unit tests + 4 property-based tests and playground page `pipe_apply.html`. Metric: 38 → 39 (+1 exported source file) Run: https://github.com/githubnext/tsessebe/actions/runs/24204988345 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 146 — ✅ Accepted — Run What changedAdded
Tests: 50+ unit tests + 4 property-based tests in Metric38 → 39 (+1 exported source file) Commit: 🤖 This comment is part of the Autoloop build-tsb-pandas-typescript-migration program. Run: §24204988345 |
…rtition, strMultiReplace, strIndent, strDedent Added src/stats/string_ops_extended.ts — 7 standalone advanced string operations: - strSplitExpand: split strings and expand parts to DataFrame columns (mirrors pandas str.split(expand=True)) - strExtractGroups: extract regex capture groups (named or numbered) to DataFrame (mirrors pandas str.extract) - strPartition / strRPartition: split at first/last occurrence of sep → (before, sep, after) tuple or DataFrame - strMultiReplace: apply multiple find/replace pairs in sequence (string literals or RegExp) - strIndent: prefix every non-empty line with a string (mirrors textwrap.indent) - strDedent: remove common leading whitespace from all lines (mirrors textwrap.dedent) All functions use TypeScript overloads for scalar vs Series/array dispatch. 50+ unit tests + 4 property-based tests (fast-check). Playground page string_ops_extended.html with interactive demos for all 7 functions. Run: https://github.com/githubnext/tsessebe/actions/runs/24206383170 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 147 — ✅ Accepted
New functions
All functions support TypeScript overloads for scalar / 🤖 This comment is part of the Autoloop build-tsb-pandas-typescript-migration program. Run: §24206383170 |
…ge, zscore, minMaxNormalize, coefficientOfVariation Added `src/stats/numeric_extended.ts` — 9 standalone numpy/scipy-style numeric utility functions: - `digitize` / `seriesDigitize`: bin values into intervals (mirrors numpy.digitize) - `histogram`: frequency counts with explicit bins, range, and density options (mirrors numpy.histogram) - `linspace`: evenly-spaced number sequence (mirrors numpy.linspace) - `arange`: range with step, 3 overloads (mirrors numpy.arange) - `percentileOfScore`: percentile rank of a score, 4 kinds (mirrors scipy.stats.percentileofscore) - `zscore`: z-score standardisation with ddof option (mirrors scipy.stats.zscore) - `minMaxNormalize`: scale to [0,1] or custom range (mirrors sklearn MinMaxScaler) - `coefficientOfVariation`: std/|mean| (dimensionless spread) 55 unit tests + 4 property-based tests (fast-check). Playground page `numeric_extended.html`. Run: https://github.com/githubnext/tsessebe/actions/runs/24207537328 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 148 — ✅ Accepted
Implementation highlights: Next iteration: |
Added `src/core/api_types.ts` with 31 exported runtime type-checking predicates mirroring `pandas.api.types`: Value-level predicates: `isScalar`, `isListLike`, `isArrayLike`, `isDictLike`, `isIterator`, `isNumber`, `isBool`, `isStringValue`, `isFloat`, `isInteger`, `isBigInt`, `isRegExp`, `isReCompilable`, `isMissing`, `isHashable`, `isDate`. Dtype-level predicates: `isNumericDtype`, `isIntegerDtype`, `isSignedIntegerDtype`, `isUnsignedIntegerDtype`, `isFloatDtype`, `isBoolDtype`, `isStringDtype`, `isDatetimeDtype`, `isTimedeltaDtype`, `isCategoricalDtype`, `isObjectDtype`, `isComplexDtype`, `isExtensionArrayDtype`, `isPeriodDtype`, `isIntervalDtype`. 60+ unit tests + 3 property-based tests. Playground page `api_types.html`. Run: https://github.com/githubnext/tsessebe/actions/runs/24209242279 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Iteration 149 — ✅ Accepted
|
…, catFreqTable, catCrossTab, catRecode Run: https://github.com/githubnext/tsessebe/actions/runs/24212535793
|
🤖 Iteration 150 — ✅ Accepted
|
…Frame Implements 14 formatting functions in src/stats/format_ops.ts: - Scalar formatters: formatFloat, formatPercent, formatScientific, formatEngineering, formatThousands, formatCurrency, formatCompact - Formatter factories: makeFloatFormatter, makePercentFormatter, makeCurrencyFormatter - Apply helpers: applySeriesFormatter (→ Series<string>), applyDataFrameFormatter (→ Record<string, string[]>) - String rendering: seriesToString, dataFrameToString 84 tests all pass (unit + property-based). 100% line + func coverage. Playground page added at playground/format_ops.html. Metric: 88 → 89 (pandas_features_ported). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Warning The 🤖 Autoloop Iteration 163 — ✅ Accepted
|
|
Warning The ✅ Iteration 165 — Metric: 93 (was 88 on branch, +5)Change summary: Added 5 new feature modules to bring
Tests: 155 new tests, all passing. Full suite: 3868 tests, 185 pre-existing failures (unchanged). Run: https://github.com/githubnext/tsessebe/actions/runs/24252721988 |
|
Warning The ✅ Iteration 167 — merge_orderedWhat changed: Added Files added:
Metric: 88 → 89 exported TS source files (+1) Run: https://github.com/githubnext/tsessebe/actions/runs/24255084762 |
- Added 13 unique feature modules from PR #120: astype, read_excel, clip_advanced, idxmin_idxmax, mode, nancumops, nunique, pct_change, quantile, replace, sem_var, skew_kurt, to_datetime - Added 11 unique feature modules from PR #81 (iter136): api_types, attrs, insert_pop, to_from_dict, categorical_ops, format_ops, numeric_extended, string_ops, string_ops_extended, window_extended, rolling_apply - Fixed TypeScript errors in new modules (mode, pct_change, to_datetime, to_from_dict, string_ops_extended, window_extended tests) - Fixed test expectations in rolling_apply (min window, count function) - Updated barrel exports in core/index.ts, stats/index.ts, io/index.ts, window/index.ts, and index.ts - All 24 new feature modules pass their tests (598 + 399 = 997 new tests) Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
- Resolved 20 file conflicts from main merging PR #81 (iter136) - For add/add conflicts on feature files, kept our version (already has TypeScript fixes and test corrections applied) - For barrel exports, merged both sides: kept our comprehensive exports plus added new exports from main (dataFrameFromPairs, SplitInput, extra attrs/api_types functions, format_ops extras, categorical_ops extras) - Fixed duplicate rollingApply/rollingAgg exports in src/index.ts - Fixed notna_isna.test.ts DataFrame constructor calls (need 2 args) - TypeScript: 0 errors - Tests: 4284 pass, 14 pre-existing edge-case failures Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
Implements
toDictOrientedandfromDictOriented— TypeScript equivalents ofpandas.DataFrame.to_dict()andpandas.DataFrame.from_dict().Changes
src/core/to_from_dict.ts— 7toDictOrientedorientations (dict/columns,list,series,split,tight,records,index) and 4fromDictOrientedorientations (columns,index,split,tight). Full TypeScript overloads with exact return types per orient string.tests/core/to_from_dict.test.ts— 30 unit tests + 3 property-based tests (fast-check). All pass.playground/to_from_dict.html— interactive tutorial page.src/core/index.ts,src/index.ts— updated barrel exports.Metric
29 → 30 (+1 exported source file)
🤖 This iteration is part of the Autoloop build-tsb-pandas-typescript-migration program. Run: §24166615896