Skip to content

Commit 25ae11a

Browse files
Copilotmrjf
andauthored
fix: stabilize trunc property test and apply biome formatting fixes
Agent-Logs-Url: https://github.com/githubnext/tsessebe/sessions/4dae5329-c13a-4ad9-91c9-9525efc7c78f Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent bbf8e0f commit 25ae11a

3 files changed

Lines changed: 9 additions & 19 deletions

File tree

src/core/align.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
* @module
4242
*/
4343

44-
import { Index } from "./base-index.ts";
45-
import { Series } from "./series.ts";
46-
import { DataFrame } from "./frame.ts";
47-
import { reindexSeries, reindexDataFrame } from "./reindex.ts";
48-
import type { Label, Scalar, JoinHow, Axis } from "../types.ts";
44+
import type { Axis, JoinHow, Label, Scalar } from "../types.ts";
45+
import type { Index } from "./base-index.ts";
46+
import type { DataFrame } from "./frame.ts";
47+
import { reindexDataFrame, reindexSeries } from "./reindex.ts";
48+
import type { Series } from "./series.ts";
4949

5050
// ─── public types ─────────────────────────────────────────────────────────────
5151

@@ -82,11 +82,7 @@ export interface AlignDataFrameOptions extends AlignSeriesOptions {
8282
/**
8383
* Compute the target index from `left` and `right` according to `join`.
8484
*/
85-
function resolveIndex(
86-
left: Index<Label>,
87-
right: Index<Label>,
88-
join: JoinHow,
89-
): Index<Label> {
85+
function resolveIndex(left: Index<Label>, right: Index<Label>, join: JoinHow): Index<Label> {
9086
switch (join) {
9187
case "outer":
9288
return left.union(right);
@@ -166,11 +162,7 @@ export function alignDataFrame(
166162

167163
// Normalise axis: null/undefined → align both
168164
const normalised: 0 | 1 | null =
169-
axis === null || axis === undefined
170-
? null
171-
: axis === 0 || axis === "index"
172-
? 0
173-
: 1;
165+
axis === null || axis === undefined ? null : axis === 0 || axis === "index" ? 0 : 1;
174166

175167
const alignRows = normalised === null || normalised === 0;
176168
const alignCols = normalised === null || normalised === 1;

src/core/assign.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ function _addOrReplaceColumn(
105105
resolved: readonly Scalar[] | Series<Scalar>,
106106
): DataFrame {
107107
const series: Series<Scalar> =
108-
resolved instanceof Series
109-
? resolved
110-
: new Series<Scalar>({ data: resolved, index: df.index });
108+
resolved instanceof Series ? resolved : new Series<Scalar>({ data: resolved, index: df.index });
111109

112110
// Rebuild the column map preserving insertion order.
113111
const colMap = new Map<string, Series<Scalar>>();

tests/stats/numeric_ops.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe("seriesTrunc", () => {
200200
});
201201
it("property: trunc is integer-valued", () => {
202202
fc.assert(
203-
fc.property(fc.array(fc.float({ noNaN: true })), (arr) => {
203+
fc.property(fc.array(fc.float({ noNaN: true, noDefaultInfinity: true })), (arr) => {
204204
const r = seriesTrunc(s(arr));
205205
return r.values.every((v) => typeof v === "number" && Number.isInteger(v));
206206
}),

0 commit comments

Comments
 (0)