Skip to content

docs: correct core transformation and aggregation examples - #187

Open
dajiaohuang wants to merge 1 commit into
data-forge:masterfrom
dajiaohuang:docs/fix-core-guide-examples-20261016
Open

dajiaohuang wants to merge 1 commit into
data-forge:masterfrom
dajiaohuang:docs/fix-core-guide-examples-20261016

Conversation

@dajiaohuang

Copy link
Copy Markdown

Summary

Correct executable examples and their stated results in the guide and key concepts:

  • Close the object passed to withSeries in the generated-column example and the select call in the transformed-column example. Both snippets currently fail to parse.
  • Use seeded aggregate to sum a non-empty series before dividing by its count. average takes no seed/reducer: the existing [1, 2, 3, 4] example pattern averages the skipped series and returns 3 instead of 2.5.
  • Count the first row in the dataframe aggregation seed, initialize its average from Price, and weight the running mean by the accumulated row count. With three small authored rows having prices 10, 20, 60, the corrected example reports three rows and average price 30.
  • Describe the inclusive end of between(10, 20).
  • Compare row1 with row2 in the comparer example rather than an undeclared row.

No runtime API or generated artifacts change.

Validation

On Node.js 24.14.1 / npm 11.11.0:

  • Installed the lockfile with lifecycle scripts disabled; npm run build passes.
  • Extracted the changed documentation snippets and exercised them with tiny authored rows/strings through the built public API: all six checks fail against the original documents and pass after correction.
  • Public API smoke checks pass for Series/DataFrame construction, indices, filter/select, group/aggregate, join, lazy evaluation/bake, and in-memory CSV/JSON round trips; a strict TypeScript consumer compiles.
  • 786 existing tests pass using Node's --no-experimental-strip-types with the existing Mocha/ts-node runner. Plain npm test on this Node version encounters Node's native type-stripping syntax restriction.
  • npm run pack:rollup passes; its ESM output passes a Webpack Node-target consumer smoke check (Webpack 4 requires --openssl-legacy-provider here). Native ESM consumption of the CJS exports also passes.
  • git diff --check passes.

Browser execution, filesystem extensions, external services, statistics beyond these examples, and performance were not tested.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant