Skip to content

Commit

Permalink
Merge pull request #393 from adamgilman/documentation-spelling-correc…
Browse files Browse the repository at this point in the history
…tion

correct lenght -> length
  • Loading branch information
risenW authored Feb 20, 2022
2 parents 573d349 + 6403eb8 commit 44f7607
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/danfojs-base/core/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export default class NDframe implements NDframeInterface {
}

/**
* Returns the shape of the NDFrame. Shape is determined by [row lenght, column length]
* Returns the shape of the NDFrame. Shape is determined by [row length, column length]
*/
get shape(): Array<number> {
if (this.$data.length === 0) return [0, 0]
Expand Down
2 changes: 1 addition & 1 deletion src/danfojs-base/core/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ export default class Series extends NDframe implements SeriesInterface {
}

if (!(lSeries.length === rSeries.length)) {
throw new Error("LengthError: Lenght of other must be equal to length of Series");
throw new Error("LengthError: length of other must be equal to length of Series");
}


Expand Down
4 changes: 2 additions & 2 deletions src/danfojs-base/plotting/plotly/pie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const piePlot = (ndframe: DataFrame | Series, divId: string, plotConfig:

if (config['rowPositions']) {
if (config['rowPositions'].length != cols.length) {
throw Error(`Lenght of rowPositions array must be equal to number of columns. Got ${config['rowPositions'].length}, expected ${cols.length - 1}`);
throw Error(`length of rowPositions array must be equal to number of columns. Got ${config['rowPositions'].length}, expected ${cols.length - 1}`);
}
} else {
let tempArr = [];
Expand All @@ -88,7 +88,7 @@ export const piePlot = (ndframe: DataFrame | Series, divId: string, plotConfig:

if (config['columnPositions']) {
if (config['columnPositions'].length != cols.length) {
throw Error(`Lenght of columnPositions array must be equal to number of columns. Got ${config['columnPositions'].length}, expected ${cols.length - 1}`);
throw Error(`length of columnPositions array must be equal to number of columns. Got ${config['columnPositions'].length}, expected ${cols.length - 1}`);
}
} else {
let tempArr = [];
Expand Down
10 changes: 5 additions & 5 deletions src/danfojs-base/shared/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import { DATA_TYPES } from "./defaults"
class ErrorThrower {

throwColumnNamesLengthError = (ndframe: NDframe, columns: Array<string>): void => {
const msg = `ParamError: Column names length mismatch. You provided a column of length ${columns.length} but Ndframe columns has lenght of ${ndframe.shape[1]}`
const msg = `ParamError: Column names length mismatch. You provided a column of length ${columns.length} but Ndframe columns has length of ${ndframe.shape[1]}`
throw new Error(msg)
}

throwIndexLengthError = (ndframe: NDframe, index: Array<string | number>): void => {
const msg = `IndexError: You provided an index of length ${index.length} but Ndframe rows has lenght of ${ndframe.shape[0]}`
const msg = `IndexError: You provided an index of length ${index.length} but Ndframe rows has length of ${ndframe.shape[0]}`
throw new Error(msg)
}

Expand All @@ -42,7 +42,7 @@ class ErrorThrower {
}

throwDtypesLengthError = (ndframe: NDframe, dtypes: Array<string>): void => {
const msg = `DtypeError: You provided a dtype array of length ${dtypes.length} but Ndframe columns has lenght of ${ndframe.shape[1]}`
const msg = `DtypeError: You provided a dtype array of length ${dtypes.length} but Ndframe columns has length of ${ndframe.shape[1]}`
throw new Error(msg)
}

Expand All @@ -52,12 +52,12 @@ class ErrorThrower {
}

throwColumnLengthError = (ndframe: NDframe | DataFrame, arrLen: number): void => {
const msg = `ParamError: Column data length mismatch. You provided data with length ${arrLen} but Ndframe has column of lenght ${ndframe.shape[1]}`
const msg = `ParamError: Column data length mismatch. You provided data with length ${arrLen} but Ndframe has column of length ${ndframe.shape[1]}`
throw new Error(msg)
}

throwRowLengthError = (ndframe: NDframe, arrLen: number): void => {
const msg = `ParamError: Row data length mismatch. You provided data with length ${arrLen} but Ndframe has row of lenght ${ndframe.shape[0]}`
const msg = `ParamError: Row data length mismatch. You provided data with length ${arrLen} but Ndframe has row of length ${ndframe.shape[0]}`
throw new Error(msg)
}

Expand Down
6 changes: 3 additions & 3 deletions src/danfojs-browser/tests/core/frame.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ describe("DataFrame", function () {
assert.deepEqual(df["count"].values, [ 1, 2, 3, 4 ]);
assert.deepEqual(df["sum"].values, [ 20.3, 30.456, 40.90, 90.1 ]);
});
it("throw error for wrong column lenght", function () {
it("throw error for wrong column length", function () {
const data = { alpha: [ "A", "B", "C", "D" ], count: [ 1, 2, 3, 4 ], sum: [ 20.3, 30.456, 40.90, 90.1 ] };
const df = new dfd.DataFrame(data);

assert.throws(function () {
df.addColumn("new_column", new dfd.Series([ "a", "b", "c" ])),
Error,
'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of lenght 4';
'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 4';
});

});
Expand Down Expand Up @@ -364,7 +364,7 @@ describe("DataFrame", function () {
const values = (await df.sample(2)).values;
assert.deepEqual(values, expected);
});
it("Throw error if n is greater than lenght of Dataframe", async function () {
it("Throw error if n is greater than length of Dataframe", async function () {
const data = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 20, 30, 40 ], [ 39, 89, 78 ], [ 100, 200, 300 ] ];
const cols = [ "A", "B", "C" ];
const df = new dfd.DataFrame(data, { columns: cols });
Expand Down
6 changes: 3 additions & 3 deletions src/danfojs-browser/tests/core/generic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe("Generic (NDFrame)", function () {
ndframe.$setValues([ [ 20, 20 ], [ 11.4, 211 ], [ 11.4, 211 ] ]);
},
Error,
"Row data length mismatch. You provided data with length 3 but Ndframe has row of lenght 2"
"Row data length mismatch. You provided data with length 3 but Ndframe has row of length 2"
);
});
it("Throws column length error on invalid data length in DataFrame", function () {
Expand All @@ -221,7 +221,7 @@ describe("Generic (NDFrame)", function () {
ndframe.$setValues([ [ 20, 211 ], [ 20, 20, 11.4, 211 ] ]);
},
Error,
"Column data length mismatch. You provided data with length 2 but Ndframe has column of lenght 2"
"Column data length mismatch. You provided data with length 2 but Ndframe has column of length 2"
);
});
it("retrieves the col data after row data is replaced in a Series", function () {
Expand Down Expand Up @@ -254,7 +254,7 @@ describe("Generic (NDFrame)", function () {
ndframe.$setValues([ 1, 2, 3, 4, 1, 3 ]);
},
Error,
"Row data length mismatch. You provided data with length 6 but Ndframe has row of lenght 4"
"Row data length mismatch. You provided data with length 6 but Ndframe has row of length 4"
);
});

Expand Down
10 changes: 5 additions & 5 deletions src/danfojs-browser/tests/core/series.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe("Series Functions", () => {
assert.deepEqual((await sf.sample(-1)).values.length, data.length);
});

it("Throw error if n is greater than lenght of Series", async function () {
it("Throw error if n is greater than length of Series", async function () {
const data = [ 1, 2, 3, 4, 5, 620, 30, 40, 39, 89, 78 ];
const sf = new dfd.Series(data);
try {
Expand Down Expand Up @@ -132,7 +132,7 @@ describe("Series Functions", () => {
"DtypeError: String data type does not support add operation"
);
});
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [ 1, 2, 3, 4 ];
const data2 = [ 1, 2, 3, 4, 5, 6 ];
const sf = new dfd.Series(data);
Expand Down Expand Up @@ -167,7 +167,7 @@ describe("Series Functions", () => {
"DtypeError: String data type does not support sub operation"
);
});
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [ 1, 2, 3, 4 ];
const data2 = [ 1, 2, 3, 4, 5, 6 ];
const sf = new dfd.Series(data);
Expand Down Expand Up @@ -196,7 +196,7 @@ describe("Series Functions", () => {
const sf2 = new dfd.Series(data2);
assert.throws(() => { sf.mul(sf2); }, Error, "DtypeError: String data type does not support mul operation");
});
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [ 1, 2, 3, 4 ];
const data2 = [ 1, 2, 3, 4, 5, 6 ];
const sf = new dfd.Series(data);
Expand Down Expand Up @@ -233,7 +233,7 @@ describe("Series Functions", () => {
const sf2 = new dfd.Series(data2);
assert.throws(() => { sf.div(sf2); }, Error, `DtypeError: String data type does not support div operation`);
});
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [ 1, 2, 3, 4 ];
const data2 = [ 1, 2, 3, 4, 5, 6 ];
const sf = new dfd.Series(data);
Expand Down
6 changes: 3 additions & 3 deletions src/danfojs-node/test/core/frame.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ describe("DataFrame", function () {
assert.deepEqual(df["val_count"].values, [1, 2, 3, 4]);
assert.deepEqual(df["val_sum"].values, [20.3, 30.456, 40.90, 90.1]);
});
it("throw error for wrong column lenght", function () {
it("throw error for wrong column length", function () {
const data = { alpha: ["A", "B", "C", "D"], val_count: [1, 2, 3, 4], val_sum: [20.3, 30.456, 40.90, 90.1] };
const df = new DataFrame(data);

assert.throws(function () {
df.addColumn("new_column", new Series(["a", "b", "c"])),
Error,
'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of lenght 4'
'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 4'
})

});
Expand Down Expand Up @@ -368,7 +368,7 @@ describe("DataFrame", function () {
const values = (await df.sample(2)).values;
assert.deepEqual(values, expected);
});
it("Throw error if n is greater than lenght of Dataframe", async function () {
it("Throw error if n is greater than length of Dataframe", async function () {
const data = [[1, 2, 3], [4, 5, 6], [20, 30, 40], [39, 89, 78], [100, 200, 300]];
const cols = ["A", "B", "C"];
const df = new DataFrame(data, { columns: cols });
Expand Down
6 changes: 3 additions & 3 deletions src/danfojs-node/test/core/generic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe("Generic (NDFrame)", function () {
ndframe.$setValues([[20, 20], [11.4, 211], [11.4, 211]])
},
Error,
"Row data length mismatch. You provided data with length 3 but Ndframe has row of lenght 2"
"Row data length mismatch. You provided data with length 3 but Ndframe has row of length 2"
);
});
it("Throws column length error on invalid data length in DataFrame", function () {
Expand All @@ -223,7 +223,7 @@ describe("Generic (NDFrame)", function () {
ndframe.$setValues([[20, 211], [20, 20, 11.4, 211]])
},
Error,
"Column data length mismatch. You provided data with length 2 but Ndframe has column of lenght 2"
"Column data length mismatch. You provided data with length 2 but Ndframe has column of length 2"
);
});
it("retrieves the col data after row data is replaced in a Series", function () {
Expand Down Expand Up @@ -255,7 +255,7 @@ describe("Generic (NDFrame)", function () {
ndframe.$setValues([1, 2, 3, 4, 1, 3])
},
Error,
"Row data length mismatch. You provided data with length 6 but Ndframe has row of lenght 4"
"Row data length mismatch. You provided data with length 6 but Ndframe has row of length 4"
);
});

Expand Down
10 changes: 5 additions & 5 deletions src/danfojs-node/test/core/series.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("Series Functions", () => {
assert.deepEqual((await sf.sample(-1)).values.length, data.length);
});

it("Throw error if n is greater than lenght of Series", async function () {
it("Throw error if n is greater than length of Series", async function () {
const data = [1, 2, 3, 4, 5, 620, 30, 40, 39, 89, 78];
const sf = new Series(data);
try {
Expand Down Expand Up @@ -134,7 +134,7 @@ describe("Series Functions", () => {
"DtypeError: String data type does not support add operation"
);
});
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [1, 2, 3, 4]
const data2 = [1, 2, 3, 4, 5, 6]
const sf = new Series(data)
Expand Down Expand Up @@ -169,7 +169,7 @@ describe("Series Functions", () => {
"DtypeError: String data type does not support sub operation"
);
});
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [1, 2, 3, 4]
const data2 = [1, 2, 3, 4, 5, 6]
const sf = new Series(data)
Expand Down Expand Up @@ -198,7 +198,7 @@ describe("Series Functions", () => {
const sf2 = new Series(data2)
assert.throws(() => { sf.mul(sf2) }, Error, "DtypeError: String data type does not support mul operation")
})
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [1, 2, 3, 4]
const data2 = [1, 2, 3, 4, 5, 6]
const sf = new Series(data)
Expand Down Expand Up @@ -235,7 +235,7 @@ describe("Series Functions", () => {
const sf2 = new Series(data2)
assert.throws(() => { sf.div(sf2) }, Error, `DtypeError: String data type does not support div operation`)
})
it("Throws length error if series lenght mixmatch", function () {
it("Throws length error if series length mixmatch", function () {
const data = [1, 2, 3, 4]
const data2 = [1, 2, 3, 4, 5, 6]
const sf = new Series(data)
Expand Down

0 comments on commit 44f7607

Please sign in to comment.