Skip to content

Commit bbf8e0f

Browse files
Copilotmrjf
andauthored
refactor: improve assign naming and clarify memory usage test helper
Agent-Logs-Url: https://github.com/githubnext/tsessebe/sessions/78d95042-4c45-4c08-be04-02e8afe42b80 Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent b62f28d commit bbf8e0f

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/core/frame.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,19 +310,19 @@ export class DataFrame {
310310
>
311311
>,
312312
): DataFrame {
313-
let working: DataFrame = this;
313+
let currentFrame: DataFrame = this;
314314
for (const [name, spec] of Object.entries(newCols)) {
315315
const resolved: readonly Scalar[] | Series<Scalar> =
316-
typeof spec === "function" ? spec(working) : spec;
316+
typeof spec === "function" ? spec(currentFrame) : spec;
317317
const series: Series<Scalar> =
318318
resolved instanceof Series
319319
? resolved
320-
: new Series({ data: resolved, index: working.index });
321-
const colMap = new Map<string, Series<Scalar>>(working._columns);
320+
: new Series({ data: resolved, index: currentFrame.index });
321+
const colMap = new Map<string, Series<Scalar>>(currentFrame._columns);
322322
colMap.set(name, series);
323-
working = new DataFrame(colMap, working.index);
323+
currentFrame = new DataFrame(colMap, currentFrame.index);
324324
}
325-
return working;
325+
return currentFrame;
326326
}
327327

328328
/** Drop one or more columns by name. Returns a new DataFrame. */

tests/stats/memory_usage.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function dfFromSeries(columns: Record<string, Series<Scalar>>): DataFrame {
1919
for (const [name, series] of Object.entries(columns)) {
2020
colMap.set(name, series);
2121
}
22+
// Build through the low-level constructor to preserve explicit Series dtypes in tests.
2223
const firstCol = Object.values(columns)[0];
2324
const index = new RangeIndex(firstCol?.size ?? 0);
2425
return new DataFrame(colMap, index);

0 commit comments

Comments
 (0)