Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/danfojs-base/core/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1855,8 +1855,8 @@ export default class Series extends NDframe implements SeriesInterface {
): Series | void {
const { inplace } = { inplace: false, ...options }

if (!newValue && typeof newValue !== "boolean") {
throw Error("Param Error: newValues cannot be null or undefined");
if (!newValue && typeof newValue !== "boolean" && typeof newValue !== "number") {
throw Error("Param Error: newValue cannot be null or undefined");
}

if (!index) {
Expand Down
7 changes: 7 additions & 0 deletions src/danfojs-browser/tests/core/series.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,13 @@ describe("Series Functions", () => {
sf1.append(sf2, index, { inplace: true });
assert.deepEqual(sf1.index, [ 0, 1, 2, 3, 4, 5, 6 ]);
});
it("Can append a value of zero", function() {
const data = [ 1, 2, 3, 4, "a", "b", "c" ];
const sf = new dfd.Series(data);
const expected_val = [ 1, 2, 3, 4, "a", "b", "c", 0 ];
sf.append(0, 7, { inplace: true });
assert.deepEqual(sf.values, expected_val);
});
});

describe("and", function () {
Expand Down
7 changes: 7 additions & 0 deletions src/danfojs-node/test/core/series.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,13 @@ describe("Series Functions", () => {
sf1.append(sf2, index, { inplace: true });
assert.deepEqual(sf1.index, [0, 1, 2, 3, 4, 5, 6]);
});
it("Can append a value of zero", function() {
const data = [1, 2, 3, 4, "a", "b", "c"];
const sf = new Series(data);
const expected_val = [1, 2, 3, 4, "a", "b", "c", 0];
sf.append(0, 7, { inplace: true });
assert.deepEqual(sf.values, expected_val);
})
});

describe("and", function () {
Expand Down